Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

installing makeBundle command

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