abdukhaligov/nova-command-runner
Composer 安装命令:
composer require abdukhaligov/nova-command-runner
包简介
Laravel Nova tool for running Artisan and bash(shell) commands.
README 文档
README
Description
This Nova tool lets you run artisan and bash commands directly from nova.
This is an extended version of the original package Nova Command Runner by guratr
Requirements
php: >=8.0laravel/nova: ^4.0
Features
- ⌨️ Run predefined artisan and shell commands
- 📝 Run custom artisan and shell commands
- 📄 Use variables while running commands
- 🙋♂️ Prompt the user to specify optional flags while running commands
- 📄 Use predefined values for variables using a select box or prompt the user to enter a value for the variable.
- 📖 Keep track of command run history
- 💾 No database changes required. Everything is managed from a single config file.
- 🕔 Queue long running commands
- ✅ Support command progressbar
- 📱 Responsive
- 🕶 Dark mode
Installation
You can install the nova tool in to a Laravel app that uses Nova via composer:
composer require stepanenko3/nova-command-runner
Next up, you must register the tool with Nova. This is typically done in the tools method of the NovaServiceProvider.
// in app/Providers/NovaServiceProvder.php // ... public function tools() { return [ // ... new \Stepanenko3\NovaCommandRunner\CommandRunnerTool, ]; }
Publish the config file:
php artisan vendor:publish --provider="Stepanenko3\NovaCommandRunner\ToolServiceProvider"
Add your commands to config/nova-command-runner.php
Usage
Click on the "Command Runner" menu item in your Nova app to see the tool.
Configuration
All the configuration is managed from a single configuration file located in config/nova-command-runner.php
Adding Commands
All the commands which needs to be easily accessible should be defined in the commands array
in the configuration file.
Command Options
- run : command to run (E.g. route:cache)
- type : button class (primary, secondary, success, danger, warning, info, light, dark, link)
- group: Group name (optional)
- variables : Array of variables used in the command(optional)
- command_type : Type of the command.(artisan or bash. Default artisan)
- flags : Array of optional flags for the command(optional)
- output_size: crops output of the given command to the specified number of lines
- timeout: updates the timeout limit for the given queued command
Examples
'commands' => [ // Basic command 'Clear Cache' => [ 'run' => 'cache:clear', 'type' => 'danger', 'group' => 'Cache', ], // Bash command 'Disk Usage' => [ 'run' => 'df -h', 'type' => 'danger', 'group' => 'Statistics', 'command_type' => 'bash' ], // Command with variable 'Clear Cache' => [ 'run' => 'cache:forget {cache key}', 'type' => 'danger', 'group' => 'Cache' ], // Command with advanced variable customization 'Clear Cache' => [ 'run' => 'cache:forget {cache key}', 'type' => 'danger', 'group' => 'Cache', 'variables' => [ [ 'label' => 'cache key' // This needs to match with variable defined in the command, 'field' => 'select' // Allowed values (text,number,tel,select,date,email,password), 'options' => [ 'blog-cache' => 'Clear Blog Cache', 'app-cache' => 'Clear Application Cache' ], 'placeholder' => 'Select An Option' ] ] ], // Command with flags 'Run Migrations' => [ 'run' => 'migrate --force', 'type' => 'danger', 'group' => 'Migration', ], // Command with optional flags 'Run Migrations' => [ 'run' => 'migrate', 'type' => 'danger', 'group' => 'Migration', 'flags' => [ // These optional flags will be prompted as a checkbox for the user // And will be appended to the command if the user checks the checkbox '--force' => 'Force running in production' ] ], // Command with help text 'Run Migrations' => [ 'run' => 'migrate --force', 'type' => 'danger', 'group' => 'Migration', // You can also add html for help text. 'help' => 'This is a destructive operation. Proceed only if you really know what you are doing.' ], // Queueing commands 'Clear Cache' => [ 'run' => 'cache:clear --should-queue', 'type' => 'danger', 'group' => 'Cache', ], // Queueing commands on custom queue and connection 'Clear Cache' => [ 'run' => 'cache:clear --should-queue --cr-queue=high --cr-connection=database', 'type' => 'danger', 'group' => 'Cache', ], ],
Command with Progress bar
Create Artisan command with progress bar. For example:
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Stepanenko3\NovaCommandRunner\Console\HasNovaProgressBar; class LongCommand extends Command { use HasNovaProgressBar; protected $signature = 'command:long'; public function handle() { $bar = $this->createProgressBar(10); foreach (range(1, 10) as $i) { sleep(1); $bar->advance(); } $bar->finish(); return Command::SUCCESS; } }
Add your command to config commands list
'commands' => [ ... // Queueing long-running commands with custom timeout limit and output size 'Long Command' => [ 'run' => 'command:long --should-queue', // '--should-queue' is a required option to display the progressbar 'type' => 'primary', 'group' => 'Application', 'timeout' => 120, // Updates the timeout limit for the given queued command 'output_size' => 3, // The number of last lines to be displayed in the output ], ]
Other Customizations
// Limit the command run history to latest 10 runs 'history' => 10, // Tool name displayed in the navigation menu 'navigation_label' => 'Command Runner', // Any additional info to display on the tool page. Can contain string and html. 'help' => '', // Groups whose commands should not be running simultaneously, ['*'] to apply this globally to all commands 'unique_command_groups' => [], // Allow running of custom artisan and bash(shell) commands 'custom_commands' => ['artisan','bash'], // Allow running of custom artisan commands only(disable custom bash(shell) commands) 'custom_commands' => ['artisan'], // Allow running of custom bash(shell) commands only(disable custom artisan commands) 'custom_commands' => ['bash'], // Disable running of custom commands. 'custom_commands' => [], 'without_overlapping' => [ // Blocks running commands simultaneously under the given groups. Use '*' for block all groups 'groups' => [], // Blocks running commands simultaneously. Use '*' for block all groups 'commands' => [], ],
Screenshots
Credits
Contributing
Thank you for considering contributing to this package! Please create a pull request with your contributions with detailed explanation of the changes you are proposing.
License
This package is open-sourced software licensed under the MIT license.
abdukhaligov/nova-command-runner 适用场景与选型建议
abdukhaligov/nova-command-runner 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 01 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「shell」 「commands」 「nova」 「laravel」 「bash」 「artisan」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 abdukhaligov/nova-command-runner 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 abdukhaligov/nova-command-runner 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 abdukhaligov/nova-command-runner 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
A Laravel Nova card.
Collection of handy Laravel artisan commands that most projects needs
Additional artisan commands for Laravel
AMWSCAN (Antimalware Scanner) is a php antimalware/antivirus scanner console script written in php for scan your project. This can work on php projects and a lot of others platform.
Shell command module for PHP.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-28






