This repository is useful for beginners. I created a starter kit for Symfony 4.4 (LTS), based on the website-skeleton project provided by Symfony itself. This one is more complete to start a real project.
It shows how to use WebpackEncore, TimeContinuum, User Auth and other stuffs (such as a Makefile, fixtures, Unit and Functional tests, Behat, Bootstrap (Sass/JQuery), Stimulus, Guard, Events, Entity traits, Q&A tools, translations, commands...) following the recommended SensioLabs best practices.
1 . Clone the current repository:
$ git clone 'https://github.com/GaetanRole/symfony-lts-website-skeleton-starter'
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
$ yarn install
$ yarn run dev
$ bin/console doctrine:database:create # (d:d:c)
$ bin/console doctrine:migration:migrate # (d:m:m)
$ bin/console doctrine:fixtures:load # (d:f:l)
$ bin/console doctrine:migration:status # (d:m:st)
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 !
$ cd symfony-lts-website-skeleton-starter
$ symfony server:start --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 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...
Execute this command to run PHPUnit and Behat tests:
$ make tests
Do not hesitate to improve this repository, by creating your PR on GitHub with a description which explains it.
Ask your question on [email protected]
.