My Favorite Symfony Console Commands
Displays info about the current project. I use this command to check the version of symfony being used, the version of PHP being used, and whether or not Xdebug is enabled. I check Xdebug because when it is enabled, composer performance is greatly affected.
Compiles and moves all assets managed by assetic (images, CSS, JS) to the filesystem. In my case, it compiles my LESS into CSS and moves it to the filesystem. I also use assetic to manage my JS files.
Compiles and moves all assets managed by assetic (images, CSS, JS) to the filesystem as they are modified. I generally always have this command running when actively working in a LESS or JS file.
Clears the cache. This is particularly helpful and necessary when deploying changes to a Symfony production environment.
Lists all available routes in the application. I use this to easily find a route name when generating a URL in a template or a controller.
Creates a database using the default connection’s name. I use this command to initialize a database for my projects.
Generates the create, read, update, and delete methods for a specified entity. I pretty much use this command for all of my entities as it is a huge time saver.
Generates entity classes with attributes and methods bases on your database mapping information. I never manually create any class that maps to the database; I always create the database mapping first and use this console command to generate the entity class for me. This is a huge time saver.
Synchronize the database schema with the current mapping information. I use this command to quickly bring my database up to sync when, for instance, I add or remove an attribute from an entity. This command should only be used in pre-production versions of your app. For production environments, Doctrine Migrations should be used to change the database schema.
Change the password of a user. I use this command to quickly change the password of a user for testing purposes.
Remove a role from a user. This command is extremely helpful when testing user permissions.
Add a role to a user. This command is extremely helpful when testing user permissions.
Generates a new bundle. This command allows for quickly generating new bundles. I like it because it is interactive and therefore it is much less likely that I will forget a step when creating a new bundle. It can even register the new bundle in the AppKernel for you.