Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Symfony Migration Bundle Laravel Package

atournayre/symfony-migration-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. 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.

  2. 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.)

  3. Key Files

    • config/packages/atournayre_maker.yaml (Symfony config)
    • src/Maker/ (Custom templates, if extended)

Implementation Patterns

Workflow Integration

  1. 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.)

  2. 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')
    ]);
    
  3. Symfony ↔ Laravel Bridge

    • Use symfony/maker-bundle in Laravel via require-dev and alias commands in artisan.
    • Example artisan alias in app/Console/Kernel.php:
      protected $commands = [
          \Symfony\MakerBundle\Command\MakeEntityCommand::class,
          // Alias Symfony commands as Laravel tasks
      ];
      

Daily Usage Patterns

  • Scaffolding: Generate migrations, entities, and CRUD in one command.
  • Refactoring: Update migrations when altering Doctrine entities.
  • Team Onboarding: Standardize migration templates across developers.

Gotchas and Tips

Pitfalls

  1. Laravel Compatibility

    • The bundle is Symfony-first. Laravel’s Eloquent migrations differ from Doctrine’s.
    • Fix: Use as a template source or adapt output to Laravel’s Schema builder.
  2. Archived Status

    • No active maintenance; fork or patch locally if needed.
    • Tip: Check symfony/maker-bundle for updates.
  3. PHP 8.1+ Requirement

    • May conflict with older Laravel versions.
    • Workaround: Use Docker or local PHP 8.1+ environment.

Debugging

  • Command Errors: Verify Symfony’s maker-bundle is installed and configured.
    php artisan make:entity --help  # Check if commands register
    
  • Template Issues: Override templates in resources/stubs/ (Laravel) or src/Maker/ (Symfony).

Extension Points

  1. 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"
    
  2. 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).

  3. Testing Mock the bundle’s services in PHPUnit:

    $this->app->instance(
        \Atournayre\MakerBundle\Generator::class,
        $this->createMock(\Atournayre\MakerBundle\Generator::class)
    );
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle