### Install MakerBundle Source: https://context7.com/symfony/maker-bundle/llms.txt Install the MakerBundle as a development dependency using Composer. ```bash composer require --dev symfony/maker-bundle ``` -------------------------------- ### Install project dependencies Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Install the necessary project dependencies using Composer. ```bash composer install ``` -------------------------------- ### Serve Documentation Locally Source: https://github.com/symfony/maker-bundle/blob/1.x/README.md Starts a local PHP server to host the generated documentation files. ```bash php -S localhost:8000 -t output/ ``` -------------------------------- ### Build Documentation Locally Source: https://github.com/symfony/maker-bundle/blob/1.x/README.md Commands to install dependencies and execute the build script for the documentation. ```bash cd _docs_build/ composer install php build.php ``` -------------------------------- ### Install Scheduler Component Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeScheduler.txt Manual installation command for the Symfony Scheduler component via Composer. ```bash composer require symfony/scheduler ``` -------------------------------- ### Install Twig Bundle Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeController.txt Install the Twig bundle using Composer to enable automatic Twig template generation for controllers. ```bash composer require symfony/twig-bundle ``` -------------------------------- ### Install Symfony MakerBundle Source: https://github.com/symfony/maker-bundle/blob/1.x/docs/index.rst Use Composer to add the bundle as a development dependency. ```terminal $ composer require --dev symfony/maker-bundle ``` -------------------------------- ### Install Symfonycasts Reset Password Bundle Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeResetPassword.txt Use Composer to add the required bundle to your project. ```bash composer require symfonycasts/reset-password-bundle ``` -------------------------------- ### Final Class Generation Example Source: https://github.com/symfony/maker-bundle/blob/1.x/docs/index.rst Example of a class generated with the final keyword. ```php final class MyVoter { ... } ``` -------------------------------- ### Get Help for a Maker Command Source: https://github.com/symfony/maker-bundle/blob/1.x/docs/index.rst Display help information for a specific maker command. ```terminal $ php bin/console make:controller --help ``` -------------------------------- ### Generate a Formatted Migration Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeMigration.txt This command generates a new migration file with pre-defined formatting. Use this when you need a structured starting point for your migration. ```bash php %command.full_name% --formatted ``` -------------------------------- ### Generate Basic Controller Source: https://context7.com/symfony/maker-bundle/llms.txt Generate a new controller class. If Twig is installed, a template is automatically created. ```bash php bin/console make:controller ProductController ``` -------------------------------- ### Install PHP CS Fixer dependencies Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Install dependencies required for the PHP CS Fixer tool. ```bash composer update --working-dir=tools/php-cs-fixer ``` -------------------------------- ### Final Entity Generation Example Source: https://github.com/symfony/maker-bundle/blob/1.x/docs/index.rst Example of a Doctrine entity generated with the final keyword. ```php #[ORM\Entity(repositoryClass: TaskRepository::class)] final class Task extends AbstractEntity { ... } ``` -------------------------------- ### Generated Controller Structure Source: https://context7.com/symfony/maker-bundle/llms.txt Example structure of a controller generated by MakerBundle, including routing and a basic index method. ```php render('product/index.html.twig', [ 'controller_name' => 'ProductController', ]); } } ``` -------------------------------- ### Generated Entity Structure Source: https://context7.com/symfony/maker-bundle/llms.txt Example structure of a Doctrine entity generated by MakerBundle, including ORM mapping and ID field. ```php id; } } ``` -------------------------------- ### List Available Maker Commands Source: https://context7.com/symfony/maker-bundle/llms.txt Display all available `make:*` commands to see the code generation options provided by MakerBundle. ```bash php bin/console list make ``` -------------------------------- ### List Available Maker Commands Source: https://github.com/symfony/maker-bundle/blob/1.x/docs/index.rst View all available commands provided by the bundle. ```terminal $ php bin/console list make ``` -------------------------------- ### Generate registration system Source: https://context7.com/symfony/maker-bundle/llms.txt Creates a complete user registration form, controller, and template. ```bash php bin/console make:registration-form ``` -------------------------------- ### Generate authentication components Source: https://context7.com/symfony/maker-bundle/llms.txt Scaffolds login forms and authenticators interactively. ```bash php bin/console make:auth ``` -------------------------------- ### Create a Custom Service Maker Source: https://context7.com/symfony/maker-bundle/llms.txt Extend AbstractMaker to create a custom command for generating service classes. Register the maker as a service tagged with 'maker.command'. ```php addArgument('name', InputArgument::OPTIONAL, 'Service class name'); } public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator): void { $className = $input->getArgument('name'); $generator->generateClass( 'App\\Service\\'.$className, 'custom_service/Service.tpl.php', ['class_name' => $className] ); $generator->writeChanges(); $this->writeSuccessMessage($io); } public function configureDependencies(DependencyBuilder $dependencies): void { // Add required dependencies } } ``` -------------------------------- ### Run project tests Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Execute the test suite using the PHPUnit Bridge. ```bash ./vendor/bin/simple-phpunit ``` -------------------------------- ### Generate Test Class with Maker Bundle Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeTest.txt Use this command to generate a new test class. Provide the test type and class name as arguments. If arguments are missing, the command will prompt for input. ```bash php %command.full_name% TestCase BlogPostTest ``` -------------------------------- ### Generate a new webhook Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeWebhook.txt Executes the command to scaffold webhook infrastructure for a specific provider. ```bash php %command.full_name% stripe ``` -------------------------------- ### Create an API Platform resource Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeEntity.txt Marks the entity as an API Platform resource to enable a hypermedia CRUD API. ```bash php %command.full_name% --api-resource ``` -------------------------------- ### Generate Controller With Tests Source: https://context7.com/symfony/maker-bundle/llms.txt Generate a controller class along with its corresponding test class. ```bash php bin/console make:controller ProductController --with-tests ``` -------------------------------- ### Generate Middleware with MakerBundle Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeMiddleware.txt Executes the command to create a new Middleware class. If the argument is omitted, the command prompts for the message class interactively. ```bash php %command.full_name% CustomMiddleware ``` -------------------------------- ### Configure PHP-CS-Fixer Path Source: https://context7.com/symfony/maker-bundle/llms.txt Set the MAKER_PHP_CS_FIXER_BINARY_PATH environment variable to specify a custom path for the PHP-CS-Fixer binary. ```bash # Set custom php-cs-fixer binary path export MAKER_PHP_CS_FIXER_BINARY_PATH=tools/vendor/bin/php-cs-fixer ``` -------------------------------- ### Generate webhook handler Source: https://context7.com/symfony/maker-bundle/llms.txt Creates components for handling incoming webhooks. ```bash php bin/console make:webhook stripe ``` -------------------------------- ### Enable Turbo Broadcasting for Entity Source: https://context7.com/symfony/maker-bundle/llms.txt Generate a Doctrine entity class with Turbo broadcasting enabled for real-time updates. ```bash php bin/console make:entity Article --broadcast ``` -------------------------------- ### Generate Unit Test Class Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeUnitTest.txt Use this command to generate a new unit test class. If the argument is missing, the command will prompt for the class name interactively. ```bash php %command.full_name% UtilTest ``` -------------------------------- ### Create New Entity Interactively Source: https://context7.com/symfony/maker-bundle/llms.txt Create a new Doctrine entity class by interactively adding fields. ```bash php bin/console make:entity BlogPost ``` -------------------------------- ### Check PHP CS Fixer version Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Verify the version of the downloaded Phar file. ```bash php src/Resources/bin/php-cs-fixer.phar --version ``` -------------------------------- ### Generate PHPUnit tests with MakerBundle Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/_WithTests.txt Executes the maker command to create unit tests in the tests/ directory. ```bash php %command.full_name% --with-tests ``` -------------------------------- ### Generate Event Listener Class Source: https://context7.com/symfony/maker-bundle/llms.txt Use this command to create a new event listener or subscriber class. You can specify the listener name directly or run interactively to choose the event. ```bash # Create event listener php bin/console make:listener ExceptionListener # Interactive mode asks for event to listen to php bin/console make:listener ``` -------------------------------- ### Configure PHP-CS-Fixer Configuration File Source: https://context7.com/symfony/maker-bundle/llms.txt Set the MAKER_PHP_CS_FIXER_CONFIG_PATH environment variable to specify a custom configuration file for PHP-CS-Fixer. ```bash # Set custom configuration file export MAKER_PHP_CS_FIXER_CONFIG_PATH=.php-cs-fixer.config.php ``` -------------------------------- ### Create API Platform Resource Entity Source: https://context7.com/symfony/maker-bundle/llms.txt Generate a Doctrine entity class configured as an API Platform resource. ```bash php bin/console make:entity Product --api-resource ``` -------------------------------- ### Create Console Command Source: https://context7.com/symfony/maker-bundle/llms.txt Generate a new Symfony console command class with boilerplate for arguments and options. ```bash php bin/console make:command app:send-newsletter ``` -------------------------------- ### Generate Event Listener Class Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeListener.txt Executes the command to create a new event listener class named ExceptionListener. ```bash php %command.full_name% ExceptionListener ``` -------------------------------- ### Generate a New Controller Class Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeController.txt Use this command to generate a new controller class. If the controller name argument is omitted, you will be prompted interactively. ```bash php %command.full_name% CoolStuffController ``` -------------------------------- ### Generate Doctrine Fixtures Class Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeFixture.txt Executes the command to create a new fixtures class. If the class name is omitted, the command prompts for it interactively. ```bash php %command.full_name% AppFixtures ``` -------------------------------- ### Generate Console Command Structure Source: https://context7.com/symfony/maker-bundle/llms.txt Use this command to generate a new console command class. It prompts for the command name and generates the basic structure, including attributes, constructor, configure method, and execute method. ```bash php bin/console make:command ``` ```php addArgument('arg1', InputArgument::OPTIONAL, 'Argument description') ->addOption('option1', null, InputOption::VALUE_NONE, 'Option description') ; } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $arg1 = $input->getArgument('arg1'); if ($arg1) { $io->note(sprintf('You passed an argument: %s', $arg1)); } if ($input->getOption('option1')) { // ... } $io->success('You have a new command! Now make it your own! Pass --help to see your options.'); return Command::SUCCESS; } } ``` -------------------------------- ### Generate Messenger Middleware Class Source: https://context7.com/symfony/maker-bundle/llms.txt Use this command to create a new Messenger middleware class for message processing pipelines. It requires a name for the middleware. ```bash php bin/console make:middleware LoggingMiddleware ``` -------------------------------- ### Run PHPStan static analysis Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Execute PHPStan to perform static analysis on the codebase. ```bash tools/phpstan/vendor/bin/phpstan ``` -------------------------------- ### Generate User Class with Maker Bundle Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeUser.txt Use this command to generate a new user class for your application's security system. The command will also update your security.yaml file and can generate a custom user provider class if needed. If the 'User' argument is omitted, the command will prompt for the class name interactively. ```bash php %command.full_name% User ``` -------------------------------- ### Generate a New Form Class Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeForm.txt Use this command to create a new form class. The form class name is a required argument. ```bash php %command.full_name% UserType ``` -------------------------------- ### Generate Doctrine fixture Source: https://context7.com/symfony/maker-bundle/llms.txt Creates a class for loading test data into the database. ```bash php bin/console make:fixture AppFixtures ``` ```php persist($product); $manager->flush(); } } ``` -------------------------------- ### Generate Event Subscriber Class Source: https://context7.com/symfony/maker-bundle/llms.txt Use this command to create a new event subscriber class that implements EventSubscriberInterface. It requires a name for the subscriber. ```bash php bin/console make:subscriber ExceptionSubscriber ``` -------------------------------- ### Generate scheduler provider Source: https://context7.com/symfony/maker-bundle/llms.txt Creates a schedule provider for recurring tasks. ```bash php bin/console make:scheduler ``` ```php add( RecurringMessage::every('1 hour', new App\Message\Message()), ) ->stateful($this->cache) ; } } ``` -------------------------------- ### Configure MakerBundle Source: https://github.com/symfony/maker-bundle/blob/1.x/docs/index.rst Override default settings in the application configuration file. ```yaml # config/packages/maker.yaml when@dev: maker: root_namespace: 'App' generate_final_classes: true generate_final_entities: false ``` -------------------------------- ### Generate Docker database config Source: https://context7.com/symfony/maker-bundle/llms.txt Creates or updates Docker Compose files for database services. ```bash # Supports MySQL, MariaDB, and PostgreSQL php bin/console make:docker-database ``` -------------------------------- ### Generate a TypeScript Stimulus Controller Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeStimulusController.txt To generate a Stimulus controller using TypeScript instead of JavaScript, use the --typescript or --ts option. ```bash php %command.full_name% hello --typescript ``` -------------------------------- ### Generate a message class and handler Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeMessage.txt Executes the command to create a new message class and handler. If the class name is omitted, the command prompts for it interactively. ```bash php %command.full_name% EmailMessage ``` -------------------------------- ### Configure MakerBundle Source: https://context7.com/symfony/maker-bundle/llms.txt Customize MakerBundle options in `config/packages/maker.yaml` to control code generation, such as root namespace and class finality. ```yaml when@dev: maker: root_namespace: 'App' generate_final_classes: true generate_final_entities: false ``` -------------------------------- ### Generate CRUD Controller for Entity Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeCrud.txt Use this command to generate a controller with CRUD operations and templates for a specified entity. If the entity name is omitted, the command will prompt for it interactively. ```bash php %command.full_name% BlogPost ``` -------------------------------- ### Generate Test Classes Source: https://context7.com/symfony/maker-bundle/llms.txt Commands to generate various types of test classes for your application, including unit, kernel, web, and API tests. ```bash # Create unit test (PHPUnit TestCase) php bin/console make:test TestCase UserTest # Create kernel test (tests with container access) php bin/console make:test KernelTestCase UserServiceTest # Create web test (HTTP client testing) php bin/console make:test WebTestCase HomeControllerTest # Create API test (API Platform testing) php bin/console make:test ApiTestCase ProductApiTest ``` -------------------------------- ### Generate an Event Subscriber Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeSubscriber.txt Executes the command to create a new event subscriber class named ExceptionSubscriber. ```bash php %command.full_name% ExceptionSubscriber ``` -------------------------------- ### Generate Invokable Controller Source: https://context7.com/symfony/maker-bundle/llms.txt Generate an invokable controller, which is a single-action controller. ```bash php bin/console make:controller ProductController --invokable ``` -------------------------------- ### Generate Doctrine migration Source: https://context7.com/symfony/maker-bundle/llms.txt Creates a migration file based on current entity mappings. ```bash # Generate migration php bin/console make:migration # Generate formatted migration (better readability) php bin/console make:migration --formatted ``` -------------------------------- ### Generate a Serializer Normalizer Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeSerializerNormalizer.txt Executes the command to create a new normalizer class named UserNormalizer. ```bash php %command.full_name% UserNormalizer ``` -------------------------------- ### Generate database services command Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeDockerDatabase.txt Executes the command to generate or update database services in the project's compose.yaml file. ```bash php %command.full_name% ``` -------------------------------- ### Generate CRUD Controller Source: https://context7.com/symfony/maker-bundle/llms.txt Generates a complete CRUD controller with templates for an existing Doctrine entity. Optionally include tests by using the --with-tests flag. ```bash # Generate CRUD for entity php bin/console make:crud BlogPost ``` ```bash # Generate CRUD with tests php bin/console make:crud Product --with-tests ``` -------------------------------- ### Generated WebTestCase Structure Source: https://context7.com/symfony/maker-bundle/llms.txt This is the basic structure of a WebTestCase generated by make:test. Use this to write tests that simulate HTTP requests and assert responses. ```php request('GET', '/'); $this->assertResponseIsSuccessful(); $this->assertSelectorTextContains('h1', 'Hello World'); } } ``` -------------------------------- ### Generate a New Stimulus Controller Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeStimulusController.txt Use this command to generate a new Stimulus controller with the specified name. If the name is omitted, the command will prompt for it. ```bash php %command.full_name% hello ``` -------------------------------- ### Generate password reset system Source: https://context7.com/symfony/maker-bundle/llms.txt Sets up a password reset flow using the SymfonyCasts Reset Password Bundle. ```bash composer require symfonycasts/reset-password-bundle php bin/console make:reset-password ``` -------------------------------- ### Generate a new Symfony command Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeCommand.txt Executes the maker command to create a new console command class. ```bash php %command.full_name% app:do-something ``` -------------------------------- ### Fix code style Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Run PHP CS Fixer to ensure code style consistency. ```bash tools/php-cs-fixer/vendor/bin/php-cs-fixer fix ``` -------------------------------- ### Update bundled PHP CS Fixer Phar Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Download and set permissions for the latest PHP CS Fixer Phar file. ```bash curl -fsSLo src/Resources/bin/php-cs-fixer.phar https://cs.symfony.com/download/php-cs-fixer-v3.phar chmod a+x src/Resources/bin/php-cs-fixer.phar ``` -------------------------------- ### Generate Messenger Message Class Source: https://context7.com/symfony/maker-bundle/llms.txt Use this command to create a new Messenger message class for asynchronous processing. It requires a name for the message. ```bash php bin/console make:message SendWelcomeEmail ``` -------------------------------- ### Generate Stimulus controller Source: https://context7.com/symfony/maker-bundle/llms.txt Creates a JavaScript or TypeScript Stimulus controller for Symfony UX. ```bash # Create JavaScript controller php bin/console make:stimulus-controller hello # Create TypeScript controller php bin/console make:stimulus-controller hello --typescript ``` -------------------------------- ### Generate Functional Test Class Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeFunctionalTest.txt Use this command to generate a new functional test class. Provide the desired class name as an argument. If the argument is omitted, the command will prompt for the class name interactively. ```bash php %command.full_name% DefaultControllerTest ``` -------------------------------- ### Regenerate entity methods Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeEntity.txt Generates getter, setter, adder, and remover methods for existing entity properties. ```bash php %command.full_name% --regenerate ``` ```bash php %command.full_name% --regenerate --overwrite ``` -------------------------------- ### Generate a validation constraint Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeValidator.txt Executes the command to generate a new validation constraint class. If the class name is omitted, the command prompts for it interactively. ```bash php %command.full_name% EnabledValidator ``` -------------------------------- ### Generated Messenger Middleware Structure Source: https://context7.com/symfony/maker-bundle/llms.txt This is the basic structure of a Messenger middleware class. Implement the handle() method to add custom logic to the message processing pipeline. ```php next()->handle($envelope, $stack); } } ``` -------------------------------- ### Update static analysis dependencies Source: https://github.com/symfony/maker-bundle/blob/1.x/CONTRIBUTING.md Update dependencies for the project and the PHPStan toolset. ```bash composer update composer update --working-dir=tools/phpstan composer update --working-dir=tools/phpstan/includes ``` -------------------------------- ### Generate Security Voter Class Source: https://context7.com/symfony/maker-bundle/llms.txt Use this command to create a new security voter class for custom authorization logic. It requires a name for the voter. ```bash php bin/console make:voter BlogPostVoter ``` -------------------------------- ### Generate Twig Extension - Symfony Maker Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeTwigExtension.txt Use this command to generate a new Twig extension class and its associated runtime class. If the class name argument is omitted, the command will prompt for it interactively. ```bash php %command.full_name% AppExtension ``` -------------------------------- ### Generated Event Listener Structure Source: https://context7.com/symfony/maker-bundle/llms.txt This is the basic structure of an event listener class generated by make:listener. The #[AsEventListener] attribute registers the method to listen for a specific event. ```php 'onKernelException', ]; } } ``` -------------------------------- ### Generate Controller Without Template Source: https://github.com/symfony/maker-bundle/blob/1.x/config/help/MakeController.txt Use this option to generate only the controller class, without creating an associated Twig template. ```bash php %command.full_name% --no-template ``` -------------------------------- ### Use UUID as Primary Key for Entity Source: https://context7.com/symfony/maker-bundle/llms.txt Generate a Doctrine entity with a UUID as its primary key. ```bash php bin/console make:entity Order --with-uuid ``` -------------------------------- ### Generated Messenger Message Structure Source: https://context7.com/symfony/maker-bundle/llms.txt This is the basic structure of a Messenger message class. Add properties and methods as needed to hold the data for the message. ```php add('email') ->add('firstName') ->add('lastName') ; } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => User::class, ]); } } ``` -------------------------------- ### Generated Messenger Message Handler Structure Source: https://context7.com/symfony/maker-bundle/llms.txt This is the basic structure of a Messenger message handler class. The #[AsMessageHandler] attribute marks the __invoke method to handle the specified message. ```php getUser(); if (!$user instanceof UserInterface) { $vote?->addReason('The user must be logged in to access this resource.'); return false; } switch ($attribute) { case self::EDIT: // logic to determine if the user can EDIT break; case self::VIEW: // logic to determine if the user can VIEW break; } return false; } } ``` -------------------------------- ### Generate Validator Constraint and Validator Class Source: https://context7.com/symfony/maker-bundle/llms.txt Generates a custom validation constraint class and its corresponding validator class. The constraint defines the validation rule and message, while the validator implements the actual validation logic. ```bash php bin/console make:validator ContainsAlphanumeric ``` ```php context->buildViolation($constraint->message) ->setParameter('{{ value }}', $value) ->addViolation() ; } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.