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

Maboo Maker Bundle Laravel Package

bornfight/maboo-maker-bundle

Symfony bundle that generates boilerplate for layered architectures. Provides interactive scaffolding plus makers for modules, Doctrine entities/domain models, write models, mappers, repositories, validators, managers, resolvers, mutations, fixtures, and GraphQL schema/types.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps

  1. Installation:

    composer require bornfight/maboo-maker-bundle --dev
    

    Ensure Bornfight\MabooMakerBundle\BornfightMabooMakerBundle::class is added to config/bundles.php under dev and test environments.

  2. First Use Case: Generate a full CRUD scaffold for a new entity (e.g., Hotel) in a module (e.g., Booking):

    bin/console make:maboo-scaffold
    
    • Select all components (press Enter to confirm defaults).
    • Choose/create a module (Booking).
    • Enter the entity name (Hotel).
    • Define fields (e.g., name:string, isOpen:boolean).
    • Press Enter to confirm.
  3. Post-Generation: Run migrations and load fixtures:

    bin/console make:migration
    bin/console doctrine:migration:migrate
    bin/console doctrine:fixtures:load
    

Where to Look First

  • Interactive Wizard: make:maboo-scaffold (recommended for beginners).
  • Individual Commands: Use specific commands (e.g., make:maboo-entity, make:maboo-repository) for targeted generation.
  • Generated Files: Check src/{Module}/ for domain logic and src/Shared/Infrastructure/ for persistence layers.
  • GraphQL Schema: Files in config/graphql/types/ and src/{Module}/Infrastructure/Resources/config/graphql/types/.

Implementation Patterns

Core Workflows

1. Layered Architecture Generation

  • Domain Layer: Generate domain models, repositories, and validators.
    bin/console make:maboo-domain-model --module=Booking --name=Hotel
    bin/console make:maboo-repository --module=Booking --name=Hotel
    
  • Application Layer: Create managers and validators.
    bin/console make:maboo-manager --module=Booking --name=Hotel
    bin/console make:maboo-validator --module=Booking --name=Hotel
    
  • Infrastructure Layer: Handle persistence (entities, mappers, fixtures) and GraphQL.
    bin/console make:maboo-entity --module=Booking --name=Hotel
    bin/console make:maboo-fixtures --module=Booking --name=Hotel
    bin/console make:maboo-gql-schema --module=Booking --entity=Hotel
    

2. Field-Level Customization

  • Define fields interactively with types (e.g., name:string:255:non-nullable).
  • Support for foreign keys (e.g., hotelId:entity:Hotel:many-to-one).
  • Example for a Room entity with a Hotel relationship:
    bin/console make:maboo-scaffold --module=Booking --name=Room
    # Add fields: `name:string`, `hotelId:entity:Hotel:many-to-one`
    

3. GraphQL Integration

  • Generate GraphQL types and schema automatically:
    bin/console make:maboo-gql-schema --module=Booking --entity=Hotel
    
  • Updates Query.types.yaml, Mutation.types.yaml, and creates resolver/mutation classes in src/{Module}/Infrastructure/GraphQL/.

4. Fixtures and Testing

  • Generate dummy data fixtures for testing:
    bin/console make:maboo-fixtures --module=Booking --name=Hotel
    bin/console doctrine:fixtures:load
    
  • Customize fixtures in src/{Module}/Infrastructure/Persistence/DataFixtures/{Module}Fixtures.php.

Integration Tips

Laravel-Specific Adaptations

  1. Service Providers:

    • Register generated managers/resolvers in config/services.php or a custom provider:
      $this->app->bind(
          \Booking\Application\Manager\HotelManager::class,
          \Booking\Infrastructure\Manager\HotelManager::class
      );
      
  2. Doctrine Configuration:

    • Ensure doctrine/orm is configured in config/packages/doctrine.yaml for entity generation.
  3. GraphQL Setup:

    • Install webonyx/graphql-php and configure in config/packages/webonyx_graphql.yaml:
      webonyx_graphql:
          definitions:
              query: ['%kernel.project_dir%/config/graphql/types/Query.types.yaml']
              mutation: ['%kernel.project_dir%/config/graphql/types/Mutation.types.yaml']
      
  4. Authentication:

    • Add middleware to GraphQL mutations (e.g., admin role check in HotelMutation):
      public function __invoke(HotelInput $input, UserInterface $user): HotelPayload
      {
          if (!$user->hasRole('ROLE_ADMIN')) {
              throw new AccessDeniedHttpException('Admin access required.');
          }
          // ...
      }
      

Extending Templates

  • Override default templates by copying files from vendor/bornfight/maboo-maker-bundle/Resources/skeleton/ to config/maboo-maker/ and customizing them.
  • Example: Modify EntityMapper.skeleton.php to add custom logic.

CI/CD Pipelines

  • Add generation steps to your CI pipeline (e.g., GitHub Actions):
    - name: Generate boilerplate
      run: php bin/console make:maboo-scaffold --module=Booking --name=Hotel --no-interaction
    

Gotchas and Tips

Pitfalls

  1. PHP Version Requirements:

    • PHP 8.0+ is mandatory for property promotion and return types. Older versions will fail during generation.
    • Fix: Upgrade PHP or use a compatibility layer (e.g., nikic/php-parser for dynamic property handling).
  2. Doctrine Migrations:

    • Generated entities require manual migration creation:
      bin/console make:migration
      bin/console doctrine:migration:migrate
      
    • Tip: Use --dry-run to preview SQL changes:
      bin/console doctrine:migration:migrate --dry-run
      
  3. GraphQL Schema Conflicts:

    • Regenerating make:maboo-gql-schema may overwrite existing schema files. Backup config/graphql/types/ before running.
    • Tip: Use --force sparingly; prefer manual edits for complex schemas.
  4. Foreign Key Limitations:

    • Foreign keys (e.g., many-to-one) require the target entity to exist. Generate parent entities first.
    • Example Workflow:
      bin/console make:maboo-scaffold --module=Booking --name=Hotel
      bin/console make:maboo-scaffold --module=Booking --name=Room --fields="hotelId:entity:Hotel:many-to-one"
      
  5. Namespace Collisions:

    • Avoid module names that conflict with Laravel core namespaces (e.g., Auth, Cache). Use prefixes like Booking_ if needed.
  6. Fixture Overwrites:

    • Running make:maboo-fixtures overwrites existing fixture classes. Backup or merge changes manually.

Debugging Tips

  1. Command Errors:

    • Check the full error stack trace. Common issues:
      • Missing Doctrine ORM (composer require doctrine/orm).
      • Invalid field types (e.g., unsupported DateTime syntax; use datetime instead).
    • Debug: Run with -v for verbose output:
      bin/console make:maboo-scaffold -v
      
  2. Template Issues:

    • If generated files are malformed, inspect the skeleton templates in vendor/bornfight/maboo-maker-bundle/Resources/skeleton/.
    • Fix: Override templates in config/maboo-maker/ and adjust as needed.
  3. GraphQL Resolvers:

    • Ensure resolvers are autowired in config/graphql.yaml:
      webonyx_graphql:
          resolvers:
              Query:
                  - \Booking\Infrastructure\GraphQL\Resolver\HotelResolver
      
  4. Validation Failures:

    • Validators may fail if field types don’t match the entity. Verify types in:
      • src/{Module}/Domain/Model/{Entity}.php (domain model).
      • src/Shared/Infrastructure/Persistence/Doctrine/Entity/{Entity}.php (entity).

Configuration Quirks

  1. Custom Field Types:

    • The bundle supports scalar types (string, integer, boolean, float). For custom types (e.g., DateTime), extend the generator:
      • Override FieldType in config/maboo-maker/FieldType.php.
      • Add logic to handle datetime fields in EntityMapper.skeleton.php.
  2. Module Structure:

    • Modules are created as folders under src/. Ensure your autoloader
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.
craftcms/url-validator
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony