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:clear
Clears the cache used by Symfony.
php bin/console cache:clear
Useful when you change configuration or environment files.
cache:warmup
Prepares the cache without handling a real request.
php bin/console cache:warmup
Speeds up your app by generating cache files before users visit it.
about
Shows basic info about your Symfony app.
php bin/console about
Quickly check environment, PHP version, debug mode, etc.
list
Shows 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:controller
Creates a new controller file.
php bin/console make:controller BlogController
make:entity
Creates or updates a Doctrine Entity.
php bin/console make:entity
Helps build your database model.
make:migration
Generates a migration file for your database changes.
php bin/console make:migration
make:user
Creates a User entity for login/authentication.
php bin/console make:user
make:auth
Creates an authentication system (login form).
php bin/console make:auth
make:form
Creates a form class for handling user inputs.
php bin/console make:form
make:crud
Generates full CRUD operations (Create, Read, Update, Delete).
php bin/console make:crud Product
make:command
Creates a custom command.
php bin/console make:command MyCommand
doctrine:database:create
Creates the database.
php bin/console doctrine:database:create
doctrine:database:drop
Deletes the database.
php bin/console doctrine:database:drop --force
doctrine:schema:update
Updates the database schema from entities.
php bin/console doctrine:schema:update --force
doctrine:migrations:migrate
Executes new migration files.
php bin/console doctrine:migrations:migrate
doctrine:fixtures:load
Loads sample data (fixtures) into the database.
php bin/console doctrine:fixtures:load
Useful for testing with fake data.
debug:router
Lists all defined routes in the app.
php bin/console debug:router
router:match
Tests if a URL matches any route.
php bin/console router:match /blog
security:encode-password
Encodes a plain-text password.
php bin/console security:encode-password
Use this to manually hash passwords.
debug:autowiring
Lists all services available for autowiring.
php bin/console debug:autowiring
debug:container
Lists all registered services in the container.
php bin/console debug:container
debug:config
Shows config values for a specific bundle.
php bin/console debug:config framework
debug:event-dispatcher
Lists all events and their listeners.
php bin/console debug:event-dispatcher
debug:twig
Shows 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! ⚙️💙
Transform from beginner to Laravel expert with our personalized Coaching Class starting June 20, 2025. Limited enrollment ensures focused attention.
1-hour personalized coaching
Build portfolio applications
Industry-standard techniques
Interview prep & job guidance
Complete your application to secure your spot
Thank you for your interest in our Laravel mentorship program. We'll contact you within 24 hours with next steps.
No comments yet. Be the first to comment!
Please log in to post a comment:
Sign in with Google