Skip to content

Instantly share code, notes, and snippets.

@alfonsodev
Created November 10, 2018 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alfonsodev/c9dc85b9df685c11febec8de11938f02 to your computer and use it in GitHub Desktop.
Save alfonsodev/c9dc85b9df685c11febec8de11938f02 to your computer and use it in GitHub Desktop.
symfony 4 tutorial

Symfony 4 tutorial

Creating the project

Project has been created with symfony new project template

composer create-project symfony/website-skeleton demo

init repo and commit

cd demo
git init && git add . && git commit -am 'initial commit'

Installing the better server

more info

composer require server --dev

Configure database

First create an empty database

sqlite3 var/data.db "SELECT 1;"

Modify your DATABASE_URL config in .env replace DATABASE_URL with

DATABASE_URL="sqlite:///%kernel.project_dir%/var/app.db"

Also change the driver in

config/packages/doctrine.yaml

to pdo_sqlite

see commit 309501007ae9f2b114893e3aee7228e461d2699b

composer require symfony/maker-bundle --dev

How to Add and Entity and Table

bin/console make:entity
bin/console make:migration
php bin/console doctrine:migrations:migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment