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.
Installation:
composer require bornfight/maboo-maker-bundle --dev
Ensure Bornfight\MabooMakerBundle\BornfightMabooMakerBundle::class is added to config/bundles.php under dev and test environments.
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
Booking).Hotel).name:string, isOpen:boolean).Post-Generation: Run migrations and load fixtures:
bin/console make:migration
bin/console doctrine:migration:migrate
bin/console doctrine:fixtures:load
make:maboo-scaffold (recommended for beginners).make:maboo-entity, make:maboo-repository) for targeted generation.src/{Module}/ for domain logic and src/Shared/Infrastructure/ for persistence layers.config/graphql/types/ and src/{Module}/Infrastructure/Resources/config/graphql/types/.bin/console make:maboo-domain-model --module=Booking --name=Hotel
bin/console make:maboo-repository --module=Booking --name=Hotel
bin/console make:maboo-manager --module=Booking --name=Hotel
bin/console make:maboo-validator --module=Booking --name=Hotel
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
name:string:255:non-nullable).hotelId:entity:Hotel:many-to-one).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`
bin/console make:maboo-gql-schema --module=Booking --entity=Hotel
Query.types.yaml, Mutation.types.yaml, and creates resolver/mutation classes in src/{Module}/Infrastructure/GraphQL/.bin/console make:maboo-fixtures --module=Booking --name=Hotel
bin/console doctrine:fixtures:load
src/{Module}/Infrastructure/Persistence/DataFixtures/{Module}Fixtures.php.Service Providers:
config/services.php or a custom provider:
$this->app->bind(
\Booking\Application\Manager\HotelManager::class,
\Booking\Infrastructure\Manager\HotelManager::class
);
Doctrine Configuration:
doctrine/orm is configured in config/packages/doctrine.yaml for entity generation.GraphQL Setup:
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']
Authentication:
admin role check in HotelMutation):
public function __invoke(HotelInput $input, UserInterface $user): HotelPayload
{
if (!$user->hasRole('ROLE_ADMIN')) {
throw new AccessDeniedHttpException('Admin access required.');
}
// ...
}
vendor/bornfight/maboo-maker-bundle/Resources/skeleton/ to config/maboo-maker/ and customizing them.EntityMapper.skeleton.php to add custom logic.- name: Generate boilerplate
run: php bin/console make:maboo-scaffold --module=Booking --name=Hotel --no-interaction
PHP Version Requirements:
nikic/php-parser for dynamic property handling).Doctrine Migrations:
bin/console make:migration
bin/console doctrine:migration:migrate
--dry-run to preview SQL changes:
bin/console doctrine:migration:migrate --dry-run
GraphQL Schema Conflicts:
make:maboo-gql-schema may overwrite existing schema files. Backup config/graphql/types/ before running.--force sparingly; prefer manual edits for complex schemas.Foreign Key Limitations:
many-to-one) require the target entity to exist. Generate parent entities first.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"
Namespace Collisions:
Auth, Cache). Use prefixes like Booking_ if needed.Fixture Overwrites:
make:maboo-fixtures overwrites existing fixture classes. Backup or merge changes manually.Command Errors:
composer require doctrine/orm).DateTime syntax; use datetime instead).-v for verbose output:
bin/console make:maboo-scaffold -v
Template Issues:
vendor/bornfight/maboo-maker-bundle/Resources/skeleton/.config/maboo-maker/ and adjust as needed.GraphQL Resolvers:
config/graphql.yaml:
webonyx_graphql:
resolvers:
Query:
- \Booking\Infrastructure\GraphQL\Resolver\HotelResolver
Validation Failures:
src/{Module}/Domain/Model/{Entity}.php (domain model).src/Shared/Infrastructure/Persistence/Doctrine/Entity/{Entity}.php (entity).Custom Field Types:
string, integer, boolean, float). For custom types (e.g., DateTime), extend the generator:
FieldType in config/maboo-maker/FieldType.php.datetime fields in EntityMapper.skeleton.php.Module Structure:
src/. Ensure your autoloaderHow can I help you explore Laravel packages today?