Laravel includes many built-in Artisan commands for creating Controllers, Models, Views, Seeders, and more. However, if you happen to want to quickly create stubs for patterns like Builders, Collections, Actions, Concerns, or Contracts, these aren’t in Laravel by default. To help with this, Punyapal Shah has put together a small and helpful package that provides commands to do just that.
Install the package using Composer and publish the config:
composer require mrpunyapal/laravel-extended-commands --devphp artisan vendor:publish --tag="laravel-extended-commands-config"
Now you are ready to begin creating these patterns using the following commands:
# Make a Builder classphp artisan make:builder {name} # Make a Collectionphp artisan make:collection {name} # Make an Actionphp artisan make:action {name} # Make a Contract (interface)php artisan make:contract {name} # Make a Concern (trait)php artisan make:concern {name}
The generated files will be placed in the appropriate folders in your Laravel app directory and will have the appropriate namespace as well (e.g., App\Actions).
There are additional options for some of these commands; you can learn more and view the source code on GitHub.