Complete List of Symfony Commands with Simple Explanations

Author

Kritim Yantra

Apr 13, 2025

Complete List of Symfony Commands with Simple Explanations

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!


🛠 Running Commands

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!


📦 Project Management Commands

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

🔧 Code Generator (make) Commands

Symfony 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) Commands

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.


🧭 Routing and URLs

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 Commands

security:encode-password

Encodes a plain-text password.

php bin/console security:encode-password

Use this to manually hash passwords.


🔍 Debugging Commands

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

💡 Custom Commands

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/.


🎯 Bonus Tips

  • Use --env=prod to run commands in production mode.
  • Add --no-interaction to skip confirmations.
  • Use --help with any command to understand how to use it.

🧠 Summary

Symfony’s CLI is one of its biggest strengths. With these commands, you can:

  • Build your app faster
  • Automate boring tasks
  • Debug like a pro
  • Manage your database easily

📌 Save this blog for reference and share it with your Symfony friends!

Got questions? Want to learn how to build custom commands? Drop a comment or message me!

Happy coding with Symfony! 💙

Tags

Symfony

Comments

No comments yet. Be the first to comment!

Please log in to post a comment:

Sign in with Google

Related Posts