### Install Symfony Scheduler Component Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeScheduler.txt Run this command to manually install the Scheduler Component if it is not already installed. The make:scheduler command will install it automatically if missing. ```bash composer require symfony/scheduler ``` -------------------------------- ### Build Documentation Locally Source: https://github.com/symfony/maker-bundle/blob/1.x/README.md Commands to install dependencies and generate the documentation locally. Run these in the `_docs_build/` directory. ```bash cd _docs_build/ composer install php build.php ``` -------------------------------- ### Install MakerBundle with Composer Source: https://github.com/symfony/maker-bundle/blob/1.x/docs/index.rst Installs and enables the bundle in your application. Assumes a standard Symfony directory structure. ```terminal $ composer require --dev symfony/maker-bundle ``` -------------------------------- ### Install dependencies with composer install Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Installs the required dependencies for the project using Composer. ```bash composer install ``` -------------------------------- ### Regenerate entity methods Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeEntity.txt Generates all getter/setter/adder/remover methods for the properties of existing entities. ```bash php %command.full_name% --regenerate ``` -------------------------------- ### Install symfony/twig-bundle for Twig template generation Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeController.txt If symfony/twig-bundle is installed, a Twig template will also be generated for the controller. ```bash composer require symfony/twig-bundle ``` -------------------------------- ### Create entity as API Platform resource Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeEntity.txt Marks the entity class as an API Platform resource, automatically providing a hypermedia CRUD API. ```bash php %command.full_name% --api-resource ``` -------------------------------- ### Create entity with broadcast option Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeEntity.txt Enables Symfony UX Turbo to broadcast all changes made to the entity to the client. ```bash php %command.full_name% --broadcast ``` -------------------------------- ### Generate a form class with a bound entity (make:form) Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeForm.txt Optionally specify the bound class in a second argument, e.g., an entity name like User. ```bash php %command.full_name% UserType User ``` -------------------------------- ### make:decorator command usage examples Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeDecorator.txt Shows the basic command and various argument combinations for generating a service decorator class. The command can be run with no arguments, a class name, a class name and decorator name, a class name and namespace, or a service id and decorator name. If an argument is missing, the command prompts interactively. ```bash php %command.full_name% ``` ```bash php %command.full_name% My\Decorated\Service\Class ``` ```bash php %command.full_name% My\Decorated\Service\Class MyServiceDecorator ``` ```bash php %command.full_name% My\Decorated\Service\Class Service\MyServiceDecorator ``` ```bash php %command.full_name% my_decorated.service.id MyServiceDecorator ``` ```bash php %command.full_name% my_decorated.service.id MyServiceDecorator ``` -------------------------------- ### Generate a form class with a fully qualified bound class (make:form) Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeForm.txt Specify a fully qualified class name like \App\Dto\UserData. Slashes must be escaped in the argument. ```bash php %command.full_name% UserType \\App\\Dto\\UserData ``` -------------------------------- ### Regenerate and overwrite entity methods Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeEntity.txt Regenerates methods and overwrites any existing methods. ```bash php %command.full_name% --regenerate --overwrite ``` -------------------------------- ### Create entity with relations Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeEntity.txt Defines relations using name:type:target format. Target is an entity class short name. Trailing ? makes relation nullable; without it, relation is NOT NULL. ```bash php %command.full_name% BlogPost --relation=author:ManyToOne:User --relation=tags:ManyToMany:Tag ``` -------------------------------- ### Generate a form class with make:form Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeForm.txt Run the make:form command with a form class name argument. If the argument is missing, the command will ask for the form class interactively. ```bash php %command.full_name% UserType ``` -------------------------------- ### Install PHP CS Fixer dependencies Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Installs the required dependencies for PHP CS Fixer in the tools/php-cs-fixer directory. ```bash composer update --working-dir=tools/php-cs-fixer ``` -------------------------------- ### Install PHPStan dependencies Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Updates project dependencies and installs PHPStan and its extra packages in the tools/phpstan directories. ```bash composer update ``` ```bash composer update --working-dir=tools/phpstan ``` ```bash composer update --working-dir=tools/phpstan/includes ``` -------------------------------- ### Install symfonycasts/reset-password-bundle via Composer Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeResetPassword.txt Required dependency for the make:reset-password command. Run this Composer command to add the SymfonyCasts ResetPasswordBundle before generating the password reset system. ```bash composer require symfonycasts/reset-password-bundle ``` -------------------------------- ### Create entity with fields on command line Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeEntity.txt Passes fields directly instead of interactive prompts, useful for scripts or non-interactive terminals. Format is name[:type[:length]], with trailing ? for nullable. Type defaults to datetime_immutable if omitted. ```bash php %command.full_name% BlogPost --field=title:string:100 --field=body:text --field=publishedAt:datetime_immutable? ``` -------------------------------- ### Create entity with enum fields Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeEntity.txt For enum fields, the third part is the backed enum class short name (unique within src/). Append ,multiple to store several values. ```bash php %command.full_name% BlogPost --field=status:enum:Status --field=labels:enum:Label,multiple ``` -------------------------------- ### Get bundled PHP CS Fixer version Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Displays the version of the downloaded PHP CS Fixer Phar. ```bash php src/Resources/bin/php-cs-fixer.phar --version ``` -------------------------------- ### Override MakerBundle configuration Source: https://github.com/symfony/maker-bundle/blob/1.x/docs/index.rst Example YAML configuration to override default MakerBundle settings. The root_namespace, generate_final_classes, and generate_final_entities options are shown. ```yaml # config/packages/maker.yaml when@dev: maker: root_namespace: 'App' generate_final_classes: true generate_final_entities: false ``` -------------------------------- ### Create entity with relation options Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeEntity.txt Shows relation options: target-field controls property name on other class (default entity name, none for no property), orphan-removal activates orphanRemoval. OneToOne does not add property by default. ```bash php %command.full_name% BlogPost --relation=cover:OneToOne:Media,target-field=post ``` ```bash php %command.full_name% BlogPost --relation=author:ManyToOne:User,target-field=none ``` ```bash php %command.full_name% BlogPost --relation=comments:OneToMany:Comment,orphan-removal ``` -------------------------------- ### Example of final class generation Source: https://github.com/symfony/maker-bundle/blob/1.x/docs/index.rst Shows the default behavior of generating classes with the final PHP keyword, except for Doctrine entities. This can be disabled with generate_final_classes. ```php final class MyVoter { ... } ``` -------------------------------- ### Generate final entity classes with generate_final_entities Source: https://github.com/symfony/maker-bundle/blob/1.x/docs/index.rst When generate_final_entities is set to true, MakerBundle adds the final PHP keyword to generated Doctrine entity classes. The example shows a final entity class with an ORM Entity attribute. This option was introduced in MakerBundle 1.61 and defaults to false. ```php #[ORM\Entity(repositoryClass: TaskRepository::class)] final class Task extends AbstractEntity { ... } ``` -------------------------------- ### Serve Documentation with PHP Built-in Server Source: https://github.com/symfony/maker-bundle/blob/1.x/README.md After generating the docs, serve them using PHP's built-in web server on port 8000. ```bash php -S localhost:8000 -t output/ ``` -------------------------------- ### Show help for make:controller Source: https://github.com/symfony/maker-bundle/blob/1.x/docs/index.rst Displays help for a specific make command, including optional arguments and options. ```terminal $ php bin/console make:controller --help ``` -------------------------------- ### List all make: commands Source: https://github.com/symfony/maker-bundle/blob/1.x/docs/index.rst Lists all available commands under the make: namespace. The output shows a sample of available commands. ```terminal $ php bin/console list make make:command Creates a new console command class make:controller Creates a new controller class make:entity Creates a new Doctrine entity class [...] make:validator Creates a new validator and constraint class make:voter Creates a new security voter class ``` -------------------------------- ### Generate a new command with make:command Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeCommand.txt Run this command to generate a new command. If the command name argument is missing, it will be asked interactively. ```bash php %command.full_name% app:do-something ``` -------------------------------- ### Run tests with simple-phpunit Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Executes the test suite using PHPUnit Bridge. ```bash ./vendor/bin/simple-phpunit ``` -------------------------------- ### Run PHPStan Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Runs static analysis using PHPStan. ```bash tools/phpstan/vendor/bin/phpstan ``` -------------------------------- ### Generate CI configuration for GitHub Actions Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeCi.txt Specify the CI platform using the --platform option. For GitHub Actions, the command generates .github/workflows/ci.yaml with lint, test, and analysis jobs. ```bash php %command.full_name% --platform=github-actions ``` -------------------------------- ### Run make:webhook with webhook name argument Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeWebhook.txt Executes the make:webhook command with the webhook name 'stripe' as an argument. If the argument is missing, the command prompts for the webhook name interactively. ```bash php %command.full_name% stripe ``` -------------------------------- ### Run make:user command Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeUser.txt Generates a new user class for security and updates security.yaml. If the argument is missing, the command prompts for the class name interactively. ```bash php %command.full_name% User ``` -------------------------------- ### Run make:auth command Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeAuth.txt Executes the make:auth command to generate authentication systems. It asks questions and can provide an empty authenticator or a full login form authentication process, updating security.yaml and generating a controller and Twig template for the login form. ```bash php %command.full_name% ``` -------------------------------- ### Run make:fixtures with class name argument Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeFixture.txt Generates a new Doctrine fixtures class named AppFixtures. If the argument is omitted, the command prompts for the class name interactively. ```bash php %command.full_name% AppFixtures ``` -------------------------------- ### Generate Middleware Class with make:middleware Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeMiddleware.txt Run the make:middleware command to generate a new Middleware class. If the argument is missing, the command will ask for the message class interactively. ```bash php %command.full_name% CustomMiddleware ``` -------------------------------- ### Generate CI configuration for GitLab CI/CD Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeCi.txt Specify the CI platform using the --platform option. For GitLab CI/CD, the command generates .gitlab-ci.yml with lint and test stages. ```bash php %command.full_name% --platform=gitlab-ci ``` -------------------------------- ### Generate a unit test class with make:unit-test Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeUnitTest.txt Run the command with the class name argument to generate a new unit test class. If the argument is omitted, the command prompts interactively for the class name. ```bash php %command.full_name% UtilTest ``` -------------------------------- ### Generate a new controller class Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeController.txt Run the make:controller command with a controller class name argument. If the argument is missing, the command will ask for the controller class name interactively. ```bash php %command.full_name% CoolStuffController ``` -------------------------------- ### Generate a new test class with make:test Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeTest.txt Run the make:test command to generate a new test class. The first argument specifies the test type (e.g., TestCase) and the second specifies the class name (e.g., BlogPostTest). If either argument is missing, the command prompts interactively. ```bash php %command.full_name% TestCase BlogPostTest ``` -------------------------------- ### Interact and Generate Methods for Controller Class Option Source: https://github.com/symfony/maker-bundle/blob/1.x/AGENTS.md Shows the recommended pattern for handling an option in a maker: interact() asks for the value only when missing and writes it to the input, while generate() reads from the input. This avoids typed property initialization errors under --no-interaction. ```php public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void { if (!$input->getOption('controller-class')) { $input->setOption('controller-class', $io->ask('...', self::getDefaultControllerClass())); } } public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator): void { $controllerClass = $input->getOption('controller-class') ?: self::getDefaultControllerClass(); } ``` -------------------------------- ### Generate an event subscriber or listener class with make:listener Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeListener.txt Run the make:listener command with a class name argument to generate a new event subscriber or listener class. If the argument is omitted, the command prompts for the class name interactively. ```bash php %command.full_name% ExceptionListener ``` -------------------------------- ### Pass arguments and options non-interactively to make:command Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeCommand.txt Use this form to provide arguments and options directly on the command line, useful for scripts or non-interactive terminals. The format is name[:type], where type can be string, bool, int, float, array, or a backed enum. Arguments are required unless the name ends with '?' (e.g., cc?:array). ```bash php %command.full_name% app:send-report --argument=recipient --argument=cc?:array --option=dry-run --option=format:Format ``` -------------------------------- ### Generate controller without template Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeController.txt Use the --no-template option to generate the controller alone, without a Twig template. ```bash php %command.full_name% --no-template ``` -------------------------------- ### Generate a serializer normalizer class Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeSerializerNormalizer.txt Run the make:serializer:normalizer command to generate a new serializer normalizer class. If the class name argument is omitted, the command prompts for it interactively. ```bash php %command.full_name% UserNormalizer ``` -------------------------------- ### Generate CRUD controller with templates for an entity Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeCrud.txt Run the make:crud command with an entity class name argument to generate a CRUD controller and templates. If the argument is missing, the command prompts for the entity class name interactively. ```bash php %command.full_name% BlogPost ``` -------------------------------- ### Generate a formatted migration with --formatted option Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeMigration.txt Use the --formatted option to generate a formatted migration. The command name is displayed as %command.full_name%. ```bash php %command.full_name% --formatted ``` -------------------------------- ### Run maker command with --with-tests flag Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/_WithTests.txt Use this command to generate tailored PHPUnit tests in the tests/ directory. The generated test is provided for review before use. ```bash php %command.full_name% --with-tests ``` -------------------------------- ### Generate a functional test class with make:functional-test Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeFunctionalTest.txt Run the command with the desired class name as an argument. If the argument is omitted, the command prompts interactively for the class name. ```bash php %command.full_name% DefaultControllerTest ``` -------------------------------- ### Generate Event Subscriber with make:subscriber Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeSubscriber.txt Run the make:subscriber command to generate a new event subscriber class. If the class name argument is omitted, the command prompts for it interactively. ```bash php %command.full_name% ExceptionSubscriber ``` -------------------------------- ### Generate TypeScript Stimulus controller with --typescript option Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeStimulusController.txt Use the --typescript (or --ts) option to generate a TypeScript file instead of a JavaScript file. The command will also interactively ask for values, targets, and classes to add to the Stimulus controller (optional). ```bash php %command.full_name% hello --typescript ``` -------------------------------- ### Update bundled PHP CS Fixer Phar Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Downloads the latest PHP CS Fixer Phar and makes it executable. ```bash curl -fsSLo src/Resources/bin/php-cs-fixer.phar https://cs.symfony.com/download/php-cs-fixer-v3.phar ``` ```bash chmod a+x src/Resources/bin/php-cs-fixer.phar ``` -------------------------------- ### Generate Stimulus controller with name argument Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeStimulusController.txt Run the command with a controller name to generate a new Stimulus controller. If the argument is missing, the command will ask for the controller name interactively. ```bash php %command.full_name% hello ``` -------------------------------- ### Generate a serializer encoder class with make:serializer:encoder Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeSerializerEncoder.txt Run the command with the desired class name as an argument. If the argument is omitted, the command prompts for the class name interactively. ```bash php %command.full_name% YamlEncoder ``` -------------------------------- ### Generate a new message class with MakeMessage command Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeMessage.txt Run the make:message command to generate a new message class and handler. If the message class argument is omitted, the command prompts interactively for it. ```bash php %command.full_name% EmailMessage ``` -------------------------------- ### Fix code style with PHP CS Fixer Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Runs PHP CS Fixer to automatically fix code style issues. ```bash tools/php-cs-fixer/vendor/bin/php-cs-fixer fix ``` -------------------------------- ### Generate a new validation constraint with MakeValidator Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeValidator.txt Run the make:validator command to generate a new validation constraint class. If the constraint class name argument is omitted, the command prompts for it interactively. ```bash php %command.full_name% EnabledValidator ``` -------------------------------- ### Generate a security voter with make:voter Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeVoter.txt Run the make:voter command with the voter class name as an argument. If the argument is omitted, the command prompts for the class name interactively. ```bash php %command.full_name% BlogPostVoter ``` -------------------------------- ### Generate CRUD controller with custom controller class and no interaction Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeCrud.txt Pass the --controller-class option to specify the controller class name and --no-interaction to skip interactive prompts. Useful for scripts or non-interactive terminals. The controller class defaults to the entity name plus 'Controller' if not provided. ```bash php %command.full_name% BlogPost --controller-class=BlogPostAdminController --no-interaction ``` -------------------------------- ### Generate a Twig extension with make:twig-extension Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeTwigExtension.txt Run the make:twig-extension command to generate a new Twig extension class with a filter and function declared via the #[AsTwigFilter] and #[AsTwigFunction] attributes. If the class name argument is omitted, the command prompts for it interactively. ```bash php %command.full_name% AppExtension ``` -------------------------------- ### Update BUNDLED_PHP_CS_FIXER_VERSION constant Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Shows the diff to update the constant in src/Util/TemplateLinter.php to the new version. ```diff - public const BUNDLED_PHP_CS_FIXER_VERSION = '3.49.0'; + public const BUNDLED_PHP_CS_FIXER_VERSION = '3.92.5'; ``` -------------------------------- ### Generate entity with UUID type using --with-uuid Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/_WithUid.txt Use the --with-uuid option to generate an entity whose 'id' property uses the UUID type from Symfony's Uid component instead of the default 'int' type. See the linked Symfony documentation for storing UUIDs in databases. ```bash php %command.full_name% --with-uuid ``` -------------------------------- ### Generate entity with ULID type using --with-ulid Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/_WithUid.txt Use the --with-ulid option to generate an entity whose 'id' property uses the ULID type from Symfony's Uid component instead of the default 'int' type. See the linked Symfony documentation for storing ULIDs in databases. ```bash php %command.full_name% --with-ulid ```