Framework cheatsheet
Symfony 7 Cheatsheet
Create apps, generate code, manage the database and debug with the Symfony CLI and console.
Setup
- Create a full web app — Create a project with Twig, Doctrine, forms and other web tools. Needs the Symfony CLI.
- Create a minimal project — Create a small project with Composer and add packages as you need them.
- Start the local server — Start the Symfony local web server in the background.
- Stop the local server — Stop the background server.
- Show project information — Print Symfony and PHP versions, the environment and debug mode.
- Check PHP requirements — Check that your PHP setup can run Symfony.
Code generation (MakerBundle)
- Install MakerBundle — Add the code generator as a development dependency.
- Create a controller — Generate a controller class and a Twig template.
- Create or update an entity — Interactively add a Doctrine entity or new fields to one.
- Generate CRUD for an entity — Create a controller, form and templates for an entity.
- Create a form type — Generate a form type class.
- Create a user class — Generate a security user entity and configure the provider.
- Create a login form — Generate a login form and authenticator.
- Create a console command — Generate your own console command.
- Create a test — Generate a PHPUnit test class.
Database (Doctrine)
- Create the database — Create the database from DATABASE_URL.
- Generate a migration — Create a migration from the differences between entities and the database.
- Run migrations — Apply pending migrations.
- Check migration status — Show applied and pending migrations.
- Validate the mapping — Check that the mapping is valid and the database is in sync.
- Run a SQL query — Run a query against the configured database.
- Load fixtures — Load sample data. Needs doctrine/doctrine-fixtures-bundle.
Debugging and cache
- List routes — Show all routes with their paths and controllers.
- List services — Show the services available in the container.
- Show configuration — Print the resolved configuration of a bundle.
- Find autowirable services — Search for services you can type-hint.
- Clear the cache — Clear the cache for the current environment.
- Lint YAML config — Check YAML files for syntax errors.
- Lint Twig templates — Check Twig templates for syntax errors.
Testing
- Install the test pack — Add PHPUnit and the browser testing tools.
- Run the tests — Run the whole PHPUnit test suite.
- Run one test — Run tests whose name matches a filter.
Related cheatsheets
- Angular 22 cheatsheet — Angular CLI commands and standalone component, signals, template, routing, HTTP and forms snippets.
- Astro cheatsheet — Build fast content sites with Astro: components, layouts, routing, content collections, islands, endpoints and deployment.
- Django 6 cheatsheet — Create projects, run migrations, test and deploy Django apps, plus the ORM queries you use every day.
- .NET and ASP.NET Core 10 cheatsheet — The dotnet CLI for creating, building, testing and publishing projects, plus common ASP.NET Core and EF Core code.
- Express 5 cheatsheet — Build HTTP servers and APIs with Express 5 on Node.js.
- FastAPI 0.115 cheatsheet — Install, run, test and deploy FastAPI apps from the command line.