sven/laravel-chained-commands

This package is abandoned and no longer maintained. No replacement package was suggested.

Chain Laravel artisan commands together

v1.0.0 2023-08-19 18:23 UTC

This package is auto-updated.

Last update: 2024-04-26 16:02:52 UTC


README

Latest Version on Packagist Total Downloads Software License Build Status StyleCI PhpStan

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.