Laravel Packages

Laravel Extended Commands

Published
Laravel Extended Commands image

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 --dev
php artisan vendor:publish --tag="laravel-extended-commands-config"

Now you are ready to begin creating these patterns using the following commands:

# Make a Builder class
php artisan make:builder {name}
 
# Make a Collection
php artisan make:collection {name}
 
# Make an Action
php 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.

Yannick Lyn Fatt photo

Staff Writer at Laravel News and Full stack web developer.

Sponsored

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article
Laravel AI SDK Adds Human-in-the-Loop Tool Approval image

Laravel AI SDK Adds Human-in-the-Loop Tool Approval

Read article
Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals image

Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals

Read article
Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs image

Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs

Read article
Blade Formatting in Laravel Pint image

Blade Formatting in Laravel Pint

Read article
Inertia DevTools Is Now on the Chrome Web Store image

Inertia DevTools Is Now on the Chrome Web Store

Read article