mrpunyapal / laravel-extended-commands
This package will have some commands which are not available in laravel.
Fund package maintenance!
MrPunyapal
Installs: 55
Dependents: 0
Suggesters: 0
Security: 0
Stars: 47
Watchers: 1
Forks: 3
Open Issues: 1
pkg:composer/mrpunyapal/laravel-extended-commands
Requires
- php: ^8.3|^8.4|^8.5
- illuminate/contracts: ^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- mrpunyapal/rector-pest: ^0.1.0
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0||^4.0
- pestphp/pest-plugin-arch: ^3.0||^4.0
- pestphp/pest-plugin-laravel: ^3.0||^4.0
- phpstan/extension-installer: ^1.3||^2.0
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
- rector/rector: ^2.2
README
Installation
You can install the package via composer:
composer require mrpunyapal/laravel-extended-commands
You can publish the config file with:
php artisan vendor:publish --tag="laravel-extended-commands-config"
This is the contents of the published config file:
return [ // Nothing to configure yet. ];
Usage
Make Builder
php artisan make:builder {name}
Make Builder with Model
php artisan make:builder {name} --model={model}
Make Collection
Create a new Eloquent custom collection class. By default the class is generated into the App\Models\Collections namespace and extends Illuminate\Database\Eloquent\Collection.
php artisan make:collection {name}
Create a collection with a model generic PHPDoc (adds @template and @extends in the generated class):
php artisan make:collection {name} --model={model}
When generating a model you can also scaffold a collection for it and inject a newCollection() method into the model using the --collection flag:
php artisan make:model {name} --collection
This will generate App\Models\Collections\{Name}Collection and add a newCollection(array $models = []) method to the model which returns the new collection instance.
Make Model with Builder
php artisan make:model {name} --builder
Make Action
Create a new action class. By default the class is generated into the App\Actions namespace and contains a handle() method.
php artisan make:action {name}
Create an invokable action (generates an __invoke method):
php artisan make:action {name} --invokable
Force overwrite an existing action file:
php artisan make:action {name} --force
Make Concern
Create a new concern (trait). By default the trait is generated into the App\\Concerns namespace.
php artisan make:concern {name}
Force overwrite an existing concern file:
php artisan make:concern {name} --force
Make Contract
Create a new contract (interface). By default the interface is generated into the App\\Contracts namespace.
php artisan make:contract {name}
Force overwrite an existing contract file:
php artisan make:contract {name} --force
Make Facade
Create a new facade class. By default the class is generated into the App\Facades namespace and extends Illuminate\Support\Facades\Facade.
php artisan make:facade {name}
The command will automatically generate a snake_case accessor based on the facade name. For example:
php artisan make:facade FileUpload
This generates App\Facades\FileUpload with accessor file_upload.
Force overwrite an existing facade file:
php artisan make:facade {name} --force
If the name argument is not provided, you will be prompted to enter it:
php artisan make:facade
# Enter FacadeName (ex. FileUpload): Payment
You can also create facades with namespaces:
php artisan make:facade Payment\Stripe
This generates App\Facades\Payment\Stripe with accessor stripe.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.