Installation Add the bundle to your Laravel project via Composer:
composer require official-dev-fusion/maker-bundle
Register the bundle in config/app.php under the extra.bundles key:
'bundles' => [
DevFusion\MakerBundle\DevFusionMakerBundle::class => ['all' => true],
],
First Command
Run the maker:list command to see available generators:
php artisan maker:list
Example: Generate a CRUD controller and views for a Post entity:
php artisan maker:generate:crud Post
Where to Look First
maker: commands via php artisan (e.g., maker:generate:model, maker:generate:controller).config/maker.php under templates; override them in config/packages/dev_fusion/maker.php.CRUD Generation Generate a full CRUD stack (model, controller, views, routes, migrations) in one command:
php artisan maker:generate:crud Post --fields="title:string(255),content:text,published:boolean"
--fields to define attributes dynamically or pass --template to use a custom template.Incremental Generation Generate components separately:
# Model + Migration
php artisan maker:generate:model Post --fields="title:string(255),slug:uniqueString(191)"
# Controller (with actions)
php artisan maker:generate:controller PostController --actions="index,store,show,edit,update,destroy"
# Views (Blade templates)
php artisan maker:generate:views Post --resource
Integration with Existing Code
/posts). Override in routes/web.php:
Route::resource('blog/posts', PostController::class);
Form and Html helpers in generated views (ensure they’re installed).Custom Templates
Extend default templates by copying them from vendor/devfusion/maker-bundle/resources/templates to config/packages/dev_fusion/maker/templates. Modify as needed.
PostController for Post model) to avoid conflicts.--fields argument or override the template’s validation logic.Template Overrides
config/packages/dev_fusion/maker/templates may not reflect changes until you clear the cache:
php artisan cache:clear
maker:refresh to reload templates dynamically:
php artisan maker:refresh
Field Type Mismatches
string(255) vs. string) may break migrations or models.php artisan maker:validate-fields "title:string(255),content:text"
Route Conflicts
/posts vs. /blog/posts).--path to specify a custom route prefix:
php artisan maker:generate:crud Post --path=admin
Dependency Hell
composer.json:
"require": {
"symfony/maker-bundle": "^1.44",
"official-dev-fusion/maker-bundle": "^1.0"
}
-v or -vv flags to debug generator commands:
php artisan maker:generate:model Post -vv
writeFiles method in custom commands.storage/logs/laravel.log for template rendering errors.Custom Commands Extend the bundle by creating a custom command that uses its generator classes:
use DevFusion\MakerBundle\Generator\Generator;
class CustomGeneratorCommand extends Command {
protected function handle() {
$generator = new Generator();
$generator->generateModel($this->argument('name'), $this->option('fields'));
}
}
Event Listeners
Listen to maker.generated events to post-process generated files:
use DevFusion\MakerBundle\Event\GeneratedEvent;
public function handle(GeneratedEvent $event) {
if ($event->getType() === 'model') {
// Modify the generated model file
}
}
Configuration
Override default settings in config/packages/dev_fusion/maker.php:
return [
'namespace' => 'App\\Generated',
'path' => 'app/Generated',
'prefix' => 'generated_',
];
How can I help you explore Laravel packages today?