Kritim Yantra
Apr 13, 2025
Symfony comes with a powerful command-line tool called bin/console that makes it easy to manage, debug, and develop your app.
In this blog, I’ve listed all the important Symfony commands with easy-to-understand explanations for beginners. This is your go-to cheat sheet when working with Symfony!
First, open your terminal and go to your Symfony project folder. Then run:
php bin/console
This will show all available commands grouped by categories.
Let’s explore them with simple explanations!
cache:clearClears the cache used by Symfony.
php bin/console cache:clear
Useful when you change configuration or environment files.
cache:warmupPrepares the cache without handling a real request.
php bin/console cache:warmup
Speeds up your app by generating cache files before users visit it.
aboutShows basic info about your Symfony app.
php bin/console about
Quickly check environment, PHP version, debug mode, etc.
listShows a list of all available commands.
php bin/console list
help [command]Shows help info for a specific command.
php bin/console help make:entity
make) CommandsSymfony uses the MakerBundle to generate code quickly.
make:controllerCreates a new controller file.
php bin/console make:controller BlogController
make:entityCreates or updates a Doctrine Entity.
php bin/console make:entity
Helps build your database model.
make:migrationGenerates a migration file for your database changes.
php bin/console make:migration
make:userCreates a User entity for login/authentication.
php bin/console make:user
make:authCreates an authentication system (login form).
php bin/console make:auth
make:formCreates a form class for handling user inputs.
php bin/console make:form
make:crudGenerates full CRUD operations (Create, Read, Update, Delete).
php bin/console make:crud Product
make:commandCreates a custom command.
php bin/console make:command MyCommand
doctrine:database:createCreates the database.
php bin/console doctrine:database:create
doctrine:database:dropDeletes the database.
php bin/console doctrine:database:drop --force
doctrine:schema:updateUpdates the database schema from entities.
php bin/console doctrine:schema:update --force
doctrine:migrations:migrateExecutes new migration files.
php bin/console doctrine:migrations:migrate
doctrine:fixtures:loadLoads sample data (fixtures) into the database.
php bin/console doctrine:fixtures:load
Useful for testing with fake data.
debug:routerLists all defined routes in the app.
php bin/console debug:router
router:matchTests if a URL matches any route.
php bin/console router:match /blog
security:encode-passwordEncodes a plain-text password.
php bin/console security:encode-password
Use this to manually hash passwords.
debug:autowiringLists all services available for autowiring.
php bin/console debug:autowiring
debug:containerLists all registered services in the container.
php bin/console debug:container
debug:configShows config values for a specific bundle.
php bin/console debug:config framework
debug:event-dispatcherLists all events and their listeners.
php bin/console debug:event-dispatcher
debug:twigShows available Twig functions, filters, and tags.
php bin/console debug:twig
You can build your own custom Symfony commands using:
php bin/console make:command MyAwesomeCommand
After that, you can code your logic inside src/Command/.
--env=prod to run commands in production mode.--no-interaction to skip confirmations.--help with any command to understand how to use it.Symfony’s CLI is one of its biggest strengths. With these commands, you can:
Got questions? Want to learn how to build custom commands? Drop a comment or message me!
Happy coding with Symfony! ⚙️💙
No comments yet. Be the first to comment!
Please log in to post a comment:
Sign in with Google
Kritim Yantra
Kritim Yantra
Kritim Yantra