kunstmaan/sensio-generator-bundle
Symfony bundle adding interactive CLI generators to scaffold code like bundles, forms, and CRUD controllers from Doctrine 2 schemas. Note: deprecated for modern Symfony—no Symfony 4/Flex support; use Symfony MakerBundle instead.
Installation (Symfony Context Only)
composer require kunstmaan/sensio-generator-bundle
Note: This bundle is not natively Laravel-compatible. Use only in Symfony 5/6 projects or as a standalone CLI tool.
First Use Case: CRUD Generation For a Symfony project, generate a CRUD controller for an existing Doctrine entity:
php bin/console generate:crud
User).src/App/Controller/.Where to Look First
php bin/console list
Key commands:
generate:bundle (creates a new bundle skeleton)generate:doctrine:crud (CRUD for Doctrine entities)generate:form (creates a form class)vendor/kunstmaan/sensio-generator-bundle/Resources/views/.config/packages/kunstmaan_sensio_generator.yaml (if using Symfony).Interactive CLI Generation
generate:crud for full-stack CRUD:
php bin/console generate:doctrine:crud User
UserController.php)templates/user/)UserType.php)config/routes.yaml)Batch Generation
php bin/console generate:doctrine:crud Product --no-interaction
php bin/console generate:doctrine:crud Category --no-interaction
Form-Centric Development
php bin/console generate:form App\Entity\User
UserType.php with validation rules.Bundle Creation
php bin/console generate:bundle --namespace=Acme/DemoBundle --format=yml
src/Acme/DemoBundle/ with standard structure.Symfony Projects:
php bin/console doctrine:fixtures:load
Customization:
vendor/kunstmaan/sensio-generator-bundle/Resources/views/ to
config/packages/kunstmaan_sensio_generator/templates/.CI/CD:
- name: Generate CRUD
run: php bin/console generate:doctrine:crud User --no-interaction
Symfony-Only Features
Repository, Entity). Not compatible with Laravel Eloquent.*.twig), which require Symfony’s Twig integration. Laravel uses Blade.Version Conflicts
symfony/console).File Overwrites
--dry-run to preview changes:
php bin/console generate:crud --dry-run
Namespace Collisions
App\Controller namespace. Conflict risk if Laravel uses a custom namespace (e.g., App\Http\Controllers).var/log/dev.log for Symfony errors.php bin/console generate:crud -v
{% extends %} blocks).php bin/console cache:clear
Custom Templates
vendor/kunstmaan/sensio-generator-bundle/Resources/views/
to config/packages/kunstmaan_sensio_generator/templates/.crud/index.html.twig for custom layouts.New Commands
Sensio\Bundle\GeneratorBundle\Command\GenerateCommand:
// src/Command/CustomGenerateCommand.php
use Sensio\Bundle\GeneratorBundle\Command\GenerateCommand;
use Sensio\Bundle\GeneratorBundle\Generator\Generator;
class CustomGenerateCommand extends GenerateCommand {
protected function configure() {
$this->setName('app:generate:custom');
}
protected function execute(InputInterface $input, OutputInterface $output) {
$this->generateCustomClass($output);
}
}
Post-Generation Hooks
# config/services.yaml
services:
App\EventListener\PostGenerateListener:
tags:
- { name: kernel.event_listener, event: sensio_generator.post_generate, method: onPostGenerate }
php artisan make:controller ProductController --resource
php artisan make:model Product -m
How can I help you explore Laravel packages today?