Installation Add the package via Composer in your Laravel project:
composer require c33s/maker-extra-bundle
Ensure the package is registered in config/app.php under the extra key in the makers array (if using Symfony Maker Bundle) or run:
php artisan maker:install
First Use Case Generate a CRUD controller with API resources (a common Laravel workflow):
php artisan make:crud Post --api
This creates a controller, repository, service, and API resource in one command.
Where to Look First
php artisan to see all available make: commands (e.g., make:crud, make:repository, make:service).CRUD Generation with Layers Generate a full repository-service-controller stack in one command:
php artisan make:crud User --repository --service --api
--repository: Creates a repository interface/class (e.g., UserRepository).--service: Adds a service layer (e.g., UserService).--api: Generates an API resource (e.g., UserResource).Custom Makers
Extend existing makers by overriding templates. For example, to modify the crud template:
vendor/c33s/maker-extra-bundle/src/Resources/skeleton/crud to resources/skeleton/crud.use Illuminate\Support\Facades\Auth;).Integration with Laravel
AppServiceProvider:
$this->app->bind(UserService::class, function ($app) {
return new UserService(new UserRepository());
});
Route::apiResource('users', UserController::class)->except(['create', 'store']);
Workflows
make:crud to scaffold boilerplate for new developers.--api or --web flags.make:test (if available) or mock services for unit tests.make:crud with make:migration for a complete feature setup:
php artisan make:migration create_posts_table
php artisan make:crud Post
validate* methods.Template Overrides
resources/skeleton may not reflect updates from package versions.composer update c33s/maker-extra-bundle and re-apply customizations.Namespace Conflicts
App\Services vs. App\Repositories).--namespace flag or manually adjust the template’s {{ namespacedClass }} placeholders.Laravel-Specific Quirks
EntityManager). Laravel uses Eloquent or repositories.EntityManager with Model::query() or repository calls.Command Caching
php artisan cache:clear
--verbose with makers to debug template rendering:
php artisan make:crud Post --verbose
APP_DEBUG=true in .env) to catch template errors.Partial Generation
Use --only to generate specific parts of a CRUD stack:
php artisan make:crud Post --only="controller,repository"
Field Customization
Pass --fields to define custom fields for the CRUD maker:
php artisan make:crud Post --fields="title:string,content:text,published:boolean"
API Resource Extensions Extend generated resources to add custom logic:
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class PostResource extends JsonResource
{
public function toArray($request)
{
return [
'id' => $this->id,
'title' => $this->title,
'custom_field' => $this->whenLoaded('customField'),
];
}
}
Laravel Mix Integration
For makers generating frontend assets (e.g., make:component), ensure your webpack.mix.js includes the new files:
mix.js('resources/js/components/NewComponent.js', 'public/js')
.postCss('resources/css/app.css', 'public/css', []);
Testing Generated Code Write feature tests for generated controllers to ensure consistency:
public function test_crud_operations()
{
$response = $this->get('/api/posts');
$response->assertStatus(200);
}
How can I help you explore Laravel packages today?