I created a starter kit for Symfony 4.4 (LTS), based on the website-skeleton provided by Symfony itself, to show how to use WebpackEncore, TimeContinuum, User Auth and so on (such as fixtures by Faker, guardAuthenticator, security:checker, unit and functional tests, Q&A tools, translations, commands ...), following the recommended SensioLabs best practices. User auth is based on Symfony form login authentication.
This repository is useful for beginners.
1 . Clone the current repository.
2 . Move in and create few .env.{environment}.local
files, according to your environments with your default configuration
or only one global .env.local
. This one is not committed to the shared repository.
.env
equals to the last.env.dist
file before november 2018.
3 .a. Execute commands below into your working folder to install the project :
$ composer install
$ composer update
$ yarn install
$ yarn run dev
$ bin/console doctrine:database:create
$ bin/console doctrine:migration:migrate
$ bin/console doctrine:migration:secure
3 .b. Or just set your DATABASE_URL and call the Makefile's install rule :
$ make install
The project's Makefile has few rules which could be very useful. In fact, you have some rules for Q&A tools and unit/functional tests. Take a look on it !
$ symfony serve --no-tls
The web server bundle is no longer used anymore. Use the Symfony binary now.
For loading User's fixture (fixture based on default locale) :
$ bin/console doctrine:fixture:load
For translation to XLIFF files (app_locales: ['fr', '%locale%']) :
$ bin/console translation:update --output-format xlf --dump-messages --force en
$ bin/console translation:update --output-format xlf --dump-messages --force fr
To use PHP CodeSniffer (for more PHPDocumentor usage, see official [https://docs.phpdoc.org/]):
$ ./vendor/bin/phpcbf src/[FILE]
$ ./vendor/bin/phpcs src/[FILE]
To see all available routes :
$ bin/console debug:router
To see all services
$ bin/console debug:container
Current User entity has some fields that are required or not. Feel free to change it according to your logic, such as adding canonical fields, salt, lastLogin and others :
$ bin/console make:entity
$ User
And do not forget to update your User's fixture :
$ bin/console doctrine:fixture:load
To use a personal command (displaying all users from DB) :
$ bin/console app:list-users --help
$ bin/console app:list-users
Feel free to create other commands such as a promotion command or a user creation ...
Do not hesitate to improve this repository, by creating your PR on GitHub with a description which explains it.
Ask your question on gaetan.role-dubruille@sensiolabs.com
.