atournayre/symfony-migration-bundle
Installation Add the package via Composer in a Laravel project (via Symfony's Composer bridge if needed):
composer require atournayre/symfony-migration-bundle
Register the bundle in config/bundles.php (Symfony) or ensure compatibility via symfony/maker-bundle in Laravel.
First Use Case Run a basic migration generator for a Doctrine entity:
php artisan make:migration CreateUsersTable --fields="name:string email:string"
(Note: Laravel-specific CLI may require aliasing Symfony commands via artisan or custom scripts.)
Key Files
config/packages/atournayre_maker.yaml (Symfony config)src/Maker/ (Custom templates, if extended)Doctrine Migration Generation Use the bundle to scaffold migrations alongside entity creation:
php artisan make:entity User --fields="name:string email:string" --migration
(Laravel: Pair with make:migration or adapt to Eloquent migrations.)
Custom Templates
Extend templates in src/Maker/ (Symfony) or override via Laravel’s make:command:
// Example: Custom migration template (Laravel)
$this->callSilently('make:migration', [
'name' => 'custom_migration',
'--template' => resource_path('stubs/migration.stub')
]);
Symfony ↔ Laravel Bridge
symfony/maker-bundle in Laravel via require-dev and alias commands in artisan.artisan alias in app/Console/Kernel.php:
protected $commands = [
\Symfony\MakerBundle\Command\MakeEntityCommand::class,
// Alias Symfony commands as Laravel tasks
];
Laravel Compatibility
Schema builder.Archived Status
symfony/maker-bundle for updates.PHP 8.1+ Requirement
maker-bundle is installed and configured.
php artisan make:entity --help # Check if commands register
resources/stubs/ (Laravel) or src/Maker/ (Symfony).Custom Fields Extend the bundle’s field definitions (Symfony) or create Laravel-specific stubs:
# config/packages/atournayre_maker.yaml
atournayre_maker:
fields:
custom_field: "type:datetime nullable:true"
Post-Generation Hooks
Use Laravel’s post-create-command events or Symfony’s maker.event.post_generate to automate post-migration tasks (e.g., seeding).
Testing Mock the bundle’s services in PHPUnit:
$this->app->instance(
\Atournayre\MakerBundle\Generator::class,
$this->createMock(\Atournayre\MakerBundle\Generator::class)
);
How can I help you explore Laravel packages today?