binarybuilds/filament-command-runner 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

binarybuilds/filament-command-runner

Composer 安装命令:

composer require binarybuilds/filament-command-runner

包简介

filament-command-runner is a Filament plugin that allows users to run artisan and shell commands directly from the Filament admin panel. All commands are executed in the background so users don't have to wait for them to finish. They can return later to view the output or optionally terminate a runn

README 文档

README

Run artisan and shell commands in the background from your Filament admin panel.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Overview

filament-command-runner is a Filament plugin that allows users to run artisan and shell commands directly from the Filament admin panel. All commands are executed in the background so users don't have to wait for them to finish. They can return later to view the output or optionally terminate a running command midway.

The plugin also keeps a detailed history of past runs including:

  • Command executed
  • User who initiated the run
  • Start time
  • Duration
  • Exit code
  • Command output

Screenshots

Command Index Command Run Command Running Kill Command Command Output

1. Installation

1.1 Install Package

You can install the plugin via composer:

composer require binarybuilds/filament-command-runner

1.2 Publish Migrations

You should publish the migration for the package and adjust it to fit your project's structure:

php artisan vendor:publish --tag=command-runner-migrations

Before running the migrations, if you are using UUID or ULID, consider adjusting the ran_by field to store string instead of unsignedBigInteger. Feel free to adjust $table->id() field if needed. Once appropriate, run the migrations command:

php artisan migrate

Usage

Register the plugin in your Filament panel service provider:

use BinaryBuilds\CommandRunner\CommandRunnerPlugin;

$panel->plugin(CommandRunnerPlugin::make());

Customizations

1. Authorization

You can restrict access to this plugin using the authorize method. This accepts a boolean or a closure that returns a boolean.

CommandRunnerPlugin::make()->authorize(fn () => auth()->user()->can('view-command-runner'))

2. Navigation Group

You can change the navigation group using the navigationGroup method. This accepts a string, UnitEnum.

CommandRunnerPlugin::make()->navigationGroup('System')

3. Navigation Label

You can customize the navigation label using the navigationLabel method.

CommandRunnerPlugin::make()->navigationLabel('Command Runner')

4. Navigation Icon

You can change the navigation icon using the navigationIcon method. This accepts a Heroicon string or a Heroicon enum value.

CommandRunnerPlugin::make()->navigationIcon('heroicon-o-exclamation-triangle')

5. Navigation Sort Order

You can change the navigation sort order using the navigationSort method.

CommandRunnerPlugin::make()->navigationSort(10)

6. Command Validation

You can define custom validation logic using the validateCommand() method. This is useful for restricting which commands can be run:

use Illuminate\Support\Str;

$panel->plugin(
    CommandRunnerPlugin::make()->validateCommand(function (string $attribute, string $value, \Closure $fail) {
        if (!Str::startsWith($value, 'php artisan')) {
            $fail("You can only run artisan commands");
        }
    })
);

7. Delete Command History

Control who can delete command history entries using a boolean or closure with canDeleteCommandHistory():

$panel->plugin(
    CommandRunnerPlugin::make()->canDeleteCommandHistory(fn ($user) => $user->isAdmin())
);

8. Purge Old Command History

Schedule the following artisan command to purge command history entries daily:

php artisan command-runner:purge-history

By default, it removes command runs older than 30 days. You can specify a custom duration like this:

php artisan command-runner:purge-history 7

This example will purge command runs older than 7 days.

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.

binarybuilds/filament-command-runner 适用场景与选型建议

binarybuilds/filament-command-runner 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13.04k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2025 年 10 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「artisan」 「filament」 「binarybuilds」 「command runner」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 binarybuilds/filament-command-runner 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 binarybuilds/filament-command-runner 我们能提供哪些服务?
定制开发 / 二次开发

基于 binarybuilds/filament-command-runner 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-11