承接 ibrostudio/laravel-artisan-command-pool 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ibrostudio/laravel-artisan-command-pool

最新稳定版本:1.1.1

Composer 安装命令:

composer require ibrostudio/laravel-artisan-command-pool

包简介

Simplify and organize Artisan commands executed programmatically

README 文档

README

Installation

You can install the package via composer:

composer require ibrostudio/laravel-artisan-command-pool

Each command in the pool has to return a Illuminate\Console\Command int state (Command::SUCCESS or Command::FAILURE)

Run statically

use IBroStudio\CommandPool\CommandPool;

CommandPool::pool([
    Command1::class,
    Command2::class,
])->run()

With command arguments (passed to each command in pool):

use IBroStudio\CommandPool\CommandPool;

CommandPool::pool([
    Command1::class,
    Command2::class,
])->runWith(['name' => 'Name'])

With different arguments for each command in pool:

use IBroStudio\CommandPool\CommandPool;

CommandPool::pool([
    Command1::class => ['name' => 'Name'],
    Command2::class => ['title' => 'Title'],
])->run()

or

use IBroStudio\CommandPool\CommandPool;

CommandPool::pool([
    Command1::class,
    Command2::class => ['title' => 'Title'],
])->runWith(['name' => 'Name'])

Run from another command

use IBroStudio\CommandPool\Concerns\HasCommandPool;

class MyContractorCommand extends Command
{
    use HasCommandPool;

    public function handle(): int
    {
        return $this->commandPool([
            Command1::class,
            Command2::class,
        ])->run();

        //or
        return $this->commandPool([
            Command1::class,
            Command2::class => ['title' => 'tata'],
        ])->runWith(['name' => $this->argument('name')]);
    }

Run conditionally

Add a runIf key with a closure returning a boolean:

use IBroStudio\CommandPool\CommandPool;

CommandPool::pool([
    Command1::class => ['runIf' => fn (): bool => false],
    Command2::class,
])->run() // will run only Command2

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-28