sven / laravel-chained-commands
Chain Laravel artisan commands together
Requires
- php: ^8.1
- illuminate/config: ^10.0
- illuminate/console: ^10.0
- illuminate/events: ^10.0
- illuminate/support: ^10.0
Requires (Dev)
- orchestra/testbench: ^8.9
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.0
README
Note
I found this unfinished code on my computer. Figured I'd publish it in case anyone would find it useful. Don't expect a lot. I also won't be merging PRs or checking issues. You're on your own, kid.
Installation
You can install this package via Composer:
composer require sven/laravel-chained-commands
Registering the service provider
Next, add the ServiceProvider
to your providers
array in config/app.php
:
'providers' => [ ... Sven\LaravelChainedCommands\ServiceProvider::class, ];
If you would like to load this package in certain environments only, take a look
at sven/env-providers
.
Usage
Publish the configuration file:
php artisan vendor:publish --provider="Sven\\LaravelChainedCommands\\ServiceProvider"
You should now have a new file at config/chained-commands.php
where you can define your command chains:
return [ RootCommand::class => [ FirstCommand::class => ['argument' => 'value'], SecondCommand::class => ['--option' => 'option-value', '--boolean-option' => false], ThirdCommand::class, ], ];
Note
Be wary of your command chains "going in circles", where commands A
and B
both call each other. If this happens,
an exception will be thrown.
Contributing
All contributions (pull requests, issues and feature requests) are welcome. Make sure to read through the CONTRIBUTING.md first, though. See the contributors page for all contributors.
License
sven/laravel-chained-commands
is licensed under the MIT License (MIT). Please see the
license file for more information.