Handy Symfony commands

Show every route inside your Symfony app, including your own.
./bin/console debug:router

Fetch a route using POST request
php bin/console router:match /api/songs/11 --method=POST

List services that can be autowired
php bin/console debug:autowiring (keyword)

List ALL services that can be autowired. Including the ones you have created.
php bin/console debug:autowiring --all

List all services (inside the container)
./bin/console debug:container

Show container parameters
./bin/console debug:container --parameters

Show Twig functions, filters and tests
./bin/console debug:twig

Check cache pools
./bin/console cache:pool:list

Clear application cache
./bin/console cache:pool:clear cache.app

Clear cache
./bin/console cache:clear

Warmup cache (can be handy on production)
./bin/console cache:warmup

Check the current configuration of a key. It also shows default values.
./bin/console debug:config key

Show all available configuration for a key (including examples)
./bin/console config:dump key subkey

Show all environment variables
./bin/console debug:dotenv

Create a secrets store on dev environment
./bin/console secrets:set

List all values from secrets store
./bin/console secrets:list (--reveal)

Database/doctrine commands

Install configuration file for docker database (mysql, mariadb or postgres)
./bin/console make:docker:database

Check environment variables that symfony binary is setting
symfony var:export --multiline

Create database:
symfony console doctrine:database:create

Create entity class:
./bin/console make:entity

Generate a migration file:
./bin/console make:migration

Execute the migration:
./bin/console doctrine:migrations:migrate

Run SQL queries:
./bin/console doctrine:query:sql 'SELECT * FROM table'

Check migrations status (general info about the migrations system):
./bin/console doctrine:migrations:status

Check migrations list (shows all of the migrations and its status):
./bin/console doctrine:migrations:list

Dump SQL that will show what updates will be done to the database if your entity has changed:
./bin/console doctrine:schema:update --dump-sql

Add --env=prod or dev on the end of each console command to run it for a specific environment!
 

Tags