Artisan Worker
Execute Laravel Artisan commands through the sTask interface with real-time progress tracking and interactive UI.
Features
- ✅ Execute any Artisan command from manager
- ✅ Real-time output with syntax highlighting
- ✅ Interactive command list - click to run
- ✅ Security validation and restrictions
- ✅ Audit logging
- ✅ Production-safe defaults
Usage
Basic
- Navigate to sTask → Dashboard
- Find Artisan widget
- Enter command (e.g.,
cache:clear) or leave empty for list - Optionally add arguments
- Click Run Task
Interactive Mode
Execute without command to see all available commands. Click any command to run it immediately.
Security
Configuration in config/artisan_security.php:
return [
// Forbidden in production
'dangerous_commands' => [
'migrate:fresh',
'migrate:reset',
'db:wipe',
],
// Require confirmation
'confirmation_required' => [
'migrate',
'db:seed',
],
// Whitelist (if set, only these allowed)
'whitelist' => [],
// Blacklist (always forbidden)
'blacklist' => [],
// Enable security
'enabled' => true,
// Log executions
'log_executions' => true,
];
Security Layers
- Dangerous Commands - Blocked in production
- Confirmation Required - Log warnings
- Whitelist/Blacklist - Flexible filtering with wildcards
- Injection Prevention - Blocks special characters
- Audit Logging - All executions logged
Examples
Whitelist only cache commands:
'whitelist' => [
'cache:*',
'view:clear',
],
Block specific command:
'blacklist' => [
'key:generate',
'down',
],
UI
Console-Style Interface
- VS Code Dark+ theme
- Monospace font
- Color-coded output:
- 🔵 Blue: Info
- 🟢 Green: Success & commands
- 🟡 Yellow: Warnings
- 🔴 Red: Errors
- ⚪ Gray: Descriptions
Interactive Commands
- Hover to highlight
- Click to execute
- Instant feedback
Configuration
Copy config to customize:
cp packages/sTask/config/artisan_security.php core/custom/config/artisan_security.php
Edit core/custom/config/artisan_security.php with your settings.
API Usage
use Seiger\sTask\Workers\ArtisanWorker;
$worker = new ArtisanWorker();
$task = $worker->createTask('run', [
'command' => 'cache:clear',
'arguments' => '--tags=views',
]);
Best Practices
- Use whitelist in production
- Review logs regularly
- Require confirmation for destructive operations
- Test in staging first
- Backup before migrations