Symfony 7 cheatsheet

Symfony 7: Code generation (MakerBundle)

9 common Symfony 7 tasks.

Install MakerBundle

Add the code generator as a development dependency.

composer require --dev symfony/maker-bundle

Create a controller

Generate a controller class and a Twig template.

php bin/console make:controller ProductController

Create or update an entity

Interactively add a Doctrine entity or new fields to one.

php bin/console make:entity Product

Generate CRUD for an entity

Create a controller, form and templates for an entity.

php bin/console make:crud Product

Create a form type

Generate a form type class.

php bin/console make:form ProductType

Create a user class

Generate a security user entity and configure the provider.

php bin/console make:user

Create a login form

Generate a login form and authenticator.

php bin/console make:security:form-login

Create a console command

Generate your own console command.

php bin/console make:command app:send-report

Create a test

Generate a PHPUnit test class.

php bin/console make:test

Was this page helpful?