| Install | |
|---|---|
composer require iamgerwin/filament-artisan-panel |
|
| Latest Version: | v1.0.0 |
| PHP: | ^8.3 |
A beautiful and powerful Filament panel for running Artisan commands with ease. Execute predefined or custom commands, track command history, and manage your Laravel application directly from your Filament admin panel.
Perfect for those moments when you need to clear the cache but your SSH keys are sleeping, or when you want to migrate without opening a terminal. Because sometimes, clicking buttons is just more fun than typing commands. 🚀
You can install the package via Composer:
composer require iamgerwin/filament-artisan-panel
Optionally, publish the configuration file:
php artisan vendor:publish --tag="filament-artisan-panel-config"
Optionally, publish the views:
php artisan vendor:publish --tag="filament-artisan-panel-views"
Register the plugin in your Filament panel configuration:
use Iamgerwin\FilamentArtisanPanel\FilamentArtisanPanelPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentArtisanPanelPlugin::make(),
]);
}
That's it! The Artisan Panel will now appear in your Filament navigation.
The package ships with sensible defaults, but you can customize everything in the config file:
return [
'navigation' => [
'enabled' => true,
'label' => 'Artisan Commands',
'icon' => 'heroicon-o-command-line',
'sort' => null,
'group' => null,
],
'history' => [
'enabled' => true,
'limit' => 50,
],
'allow_custom_artisan_commands' => false,
'allow_custom_bash_commands' => false,
'execution' => [
'timeout' => 300,
'prevent_simultaneous_execution' => false,
],
];
You can define your own commands in the configuration file:
'commands' => [
[
'label' => 'Clear Cache',
'command' => 'cache:clear',
'type' => 'artisan',
'group' => 'Cache',
'icon' => 'heroicon-o-trash',
'color' => 'danger',
'confirmation' => false,
'help' => 'Clear the application cache',
],
[
'label' => 'Run Migrations',
'command' => 'migrate',
'type' => 'artisan',
'group' => 'Database',
'icon' => 'heroicon-o-circle-stack',
'color' => 'primary',
'confirmation' => true,
'help' => 'Run the database migrations',
'options' => [
[
'name' => '--force',
'label' => 'Force',
'type' => 'checkbox',
'help' => 'Force in production',
],
],
],
],
Commands can have dynamic options that users can configure before execution:
'options' => [
[
'name' => '--force', // The command option name
'label' => 'Force', // Display label
'type' => 'checkbox', // Input type (checkbox, text, number, select)
'help' => 'Force the operation',
],
[
'name' => '--step',
'label' => 'Steps',
'type' => 'number',
'help' => 'Number of steps',
],
],
By default, custom commands are disabled for security reasons. If you want to allow users to run custom commands:
'allow_custom_artisan_commands' => true, // Allow custom artisan commands
'allow_custom_bash_commands' => false, // Keep bash commands disabled (recommended)
Warning: Enabling custom commands, especially bash commands, can be a security risk. Only enable this for trusted users in secure environments.
The package tracks all executed commands, storing:
You can configure history tracking:
'history' => [
'enabled' => true,
'limit' => 50, // Maximum number of history entries
],
History is stored in the application cache and can be cleared using the "Clear History" button in the panel.
The package comes with these commands out of the box:
Run the test suite:
composer test
Run PHPStan:
composer analyse
Run code style fixer:
composer format
Please see CHANGELOG for more information on what has changed recently.
Contributions are welcome! Please feel free to submit a Pull Request.
If you discover any security-related issues, please email iamgerwin@live.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.