Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
Laravel

Stubs in Laravel

Customize Artisan-generated class templates by publishing and editing stub files.

Stubs in Laravel — a practical guide to Laravel stubs with clear examples you can reuse in real projects.

Laravel Tutorial Series (22/27). Prefer one page? Read the complete Laravel tutorial (all 27 topics).

Short description

Stubs are templates Artisan uses when generating controllers, models, migrations, and more. Customize them to match your team standards.

Publish stubs

php artisan stub:publish

Files appear in `/stubs`.

Example idea

Edit `stubs/model.stub` to always include SoftDeletes or default `$fillable`.

Generate using your stub

php artisan make:model Comment

Artisan uses your customized stub automatically.

Why it helps

Consistent namespaces, docblocks, traits, and base classes across every generated file.

Leave a reply

Your email address will not be published. Required fields are marked *