A powerful, customizable command runner and log viewer for Laravel Nova 4, developed by Farsi Studio.
- Command Profiles: Define commands via config file with flexible categorization
- Multiple Command Types: Support for
artisan,job,service,shell, andhttpcommands - Rich Input Types: text, textarea, select, multiselect, checkbox, boolean, datepicker, tags, file upload, resource-select
- Queue Integration: Commands executed via Laravel queue jobs
- Real-time Feedback: Live output display with confirmation modals
- Security First: Built-in command validation and security controls
- Comprehensive Logging: Every execution stored with detailed metadata
- Advanced Filtering: Search by user, command, category, date, status
- Export Capabilities: Download logs as
.logfiles - Performance Analytics: Execution statistics and performance metrics
- Code Highlighting: Syntax-highlighted output display
- Policy-based Authorization: Granular permission controls
- Command Validation: Built-in security checks for shell commands
- Audit Trail: Complete execution history with user attribution
- Confirmation Modals: Required confirmations for destructive operations
composer require farsi/nova-flex-runnerphp artisan vendor:publish --tag=nova-flex-runner-configphp artisan vendor:publish --tag=nova-flex-runner-migrations
php artisan migratephp artisan vendor:publish --tag=nova-flex-runner-assetsThe tools are automatically registered via the service provider. No manual registration required.
The package uses the config/nova-flex-runner.php configuration file:
<?php
return [
// Security settings
'security' => [
'require_confirmation' => true,
'log_all_executions' => true,
'max_execution_time' => 300,
],
// Shell command settings
'shell' => [
'enabled' => false, // Enable with caution
'timeout' => 300,
'allowed_commands' => [
'/^git /',
'/^composer /',
],
],
// Command definitions
'commands' => [
// Your command categories here
],
];Commands are organized into categories. Here's an example configuration:
'commands' => [
'maintenance' => [
'name' => 'Maintenance',
'description' => 'Application maintenance commands',
'icon' => 'wrench-screwdriver',
'commands' => [
[
'name' => 'Clear Application Cache',
'slug' => 'cache-clear',
'description' => 'Clear all application caches',
'type' => 'artisan',
'command' => 'cache:clear',
'confirmation_required' => false,
'inputs' => [],
],
[
'name' => 'Put Application in Maintenance Mode',
'slug' => 'maintenance-down',
'description' => 'Put the application into maintenance mode',
'type' => 'artisan',
'command' => 'down',
'confirmation_required' => true,
'inputs' => [
[
'name' => 'message',
'label' => 'Maintenance Message',
'type' => 'textarea',
'placeholder' => 'We are currently performing maintenance...',
'required' => false,
'is_option' => true,
],
],
],
],
],
],[
'name' => 'Run Migrations',
'slug' => 'migrate',
'type' => 'artisan',
'command' => 'migrate',
'inputs' => [
[
'name' => 'force',
'label' => 'Force run in production',
'type' => 'checkbox',
'is_option' => true,
],
],
][
'name' => 'Process Data',
'slug' => 'process-data',
'type' => 'job',
'job_class' => 'App\\Jobs\\ProcessDataJob',
'queue' => 'default',
'inputs' => [
[
'name' => 'batch_size',
'label' => 'Batch Size',
'type' => 'number',
'min' => 1,
'max' => 1000,
'required' => true,
],
],
][
'name' => 'Generate Report',
'slug' => 'generate-report',
'type' => 'service',
'service_class' => 'App\\Services\\ReportService',
'method' => 'generateReport',
'inputs' => [
[
'name' => 'report_type',
'label' => 'Report Type',
'type' => 'select',
'options' => [
['value' => 'daily', 'label' => 'Daily Report'],
['value' => 'weekly', 'label' => 'Weekly Report'],
],
'required' => true,
],
],
][
'name' => 'Git Status',
'slug' => 'git-status',
'type' => 'shell',
'command' => 'git status',
'timeout' => 30,
'inputs' => [],
][
'name' => 'username',
'label' => 'Username',
'type' => 'text',
'placeholder' => 'Enter username',
'maxlength' => 50,
'required' => true,
][
'name' => 'environment',
'label' => 'Environment',
'type' => 'select',
'options' => [
['value' => 'dev', 'label' => 'Development'],
['value' => 'staging', 'label' => 'Staging'],
['value' => 'prod', 'label' => 'Production'],
],
'required' => true,
][
'name' => 'timeout',
'label' => 'Timeout (seconds)',
'type' => 'number',
'min' => 1,
'max' => 600,
'step' => 1,
'required' => true,
][
'name' => 'features',
'label' => 'Features to Enable',
'type' => 'multiselect',
'options' => [
['value' => 'feature_a', 'label' => 'Feature A'],
['value' => 'feature_b', 'label' => 'Feature B'],
],
][
'name' => 'force',
'label' => 'Force execution',
'type' => 'checkbox',
][
'name' => 'message',
'label' => 'Message',
'type' => 'textarea',
'rows' => 4,
'placeholder' => 'Enter your message...',
]You can easily add your own custom input components:
- Create a Vue component in
resources/js/components/inputs/ - Register it in the config file:
'input_types' => [
'custom-input' => [
'component' => 'CustomInput',
'props' => ['custom_prop'],
],
],The Log Viewer provides comprehensive tracking of all command executions:
- Execution History: Complete log of all command runs
- Advanced Filtering: Filter by user, command, date, status
- Performance Metrics: Duration tracking and statistics
- Export Functionality: Download logs as
.logfiles - Real-time Updates: Live status updates for running commands
Access the Log Viewer through the Nova sidebar menu "Command Logs".
- Shell Commands: Disabled by default. Enable only with extreme caution and proper command whitelisting.
- Production Safety: Never run destructive commands like
db:wipein production without proper safeguards. - Access Control: Always implement proper authorization policies.
- Input Validation: Validate all user inputs before execution.
- Audit Trail: All executions are logged for security auditing.
Implement custom authorization by defining Gate policies:
// In your AuthServiceProvider
Gate::define('viewNovaFlexRunner', function ($user) {
return $user->hasRole('admin');
});
Gate::define('executeNovaFlexRunner', function ($user) {
return $user->hasRole('admin') || $user->hasRole('developer');
});
Gate::define('viewNovaFlexRunnerLogs', function ($user) {
return $user->hasRole('admin');
});The package exposes several API endpoints for integration:
GET /nova-vendor/nova-flex-runner/api/commands- List all commandsPOST /nova-vendor/nova-flex-runner/api/execute- Execute a commandGET /nova-vendor/nova-flex-runner/api/status/{log}- Get execution statusGET /nova-vendor/nova-flex-runner/api/logs- List command logsGET /nova-vendor/nova-flex-runner/api/logs/{log}/download- Download log file
- PHP 8.1+
- Laravel 10.0+ or 11.0+
- Laravel Nova 4.0+
composer testContributions are welcome! Please see our contributing guidelines for details.
Please see CHANGELOG for more information on what has changed recently.
- Developer: Ali Sameni
- Company: Farsi Studio
- stepanenko3/nova-command-runner
- spatie/laravel-activitylog
- opcodesio/log-viewer
- filamentphp
- nova-tabs
- optimistdigital/nova-settings
The MIT License (MIT). Please see License File for more information.
Developed by Ali Sameni
Maintained by Farsi Studio
For support and updates, visit: https://github.com/farsi/nova-flex-runner