kozhinhikkodan-dev / artisan-playground
A beautiful, secure, and feature-rich UI for executing Laravel Artisan commands with role-based access control, theme support, and comprehensive command management
Fund package maintenance!
kozhinhikkodan-dev
Installs: 29
Dependents: 0
Suggesters: 0
Security: 0
Stars: 17
Watchers: 0
Forks: 1
Open Issues: 0
Language:Blade
pkg:composer/kozhinhikkodan-dev/artisan-playground
Requires
- php: ^8.2
- laravel/framework: ^10.0|^11.0|^12.0
- spatie/laravel-permission: ^5.0|^6.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0
README
A beautiful, secure, and feature-rich UI for executing Laravel Artisan commands with role-based access control, theme support, and comprehensive command management.
โจ Features
- ๐จ Beautiful Bootstrap-based UI with light and dark themes
- ๐ Role-based access control with Spatie Laravel Permission
- ๐ IP-based restrictions for enhanced security
- ๐ค Custom login credentials or standard Laravel authentication
- ๐ Command grouping (Default, Custom, Dangerous, Database, Cache)
- โก Real-time command execution with live output
- ๐ Command history with detailed logging
- ๐จ Dangerous command warnings and confirmation
- ๐ Command search and filtering
- ๐ฑ Responsive design for all devices
- ๐ฏ Parameter validation for all command arguments and options
- ๐ Execution statistics and performance metrics
๐ Installation
Requirements
- PHP: 8.2 or higher
- Laravel: 10.x, 11.x, 12.x, or higher
- Spatie Laravel Permission: 5.x or 6.x
1. Install the Package
composer require kozhinhikkodan-dev/artisan-playground
2. Publish Assets and Configuration
php artisan vendor:publish --tag=artisan-playground
3. Run Migrations
php artisan migrate
4. Install Permissions and Roles
php artisan artisan-playground:install
5. Configure Access Control
Edit the published configuration file at config/artisan-playground.php:
'access_control' => [ 'allowed_roles' => [ 'artisan-playground-super-admin', 'artisan-playground-admin', 'artisan-playground-user', ], 'required_permissions' => [ 'artisan-playground.view', ], 'allowed_ips' => [ '127.0.0.1', '192.168.1.*', '10.0.0.0/24', ], ],
โ๏ธ Configuration
Authentication Settings
'auth' => [ 'enabled' => true, 'guard' => 'web', 'custom_credentials' => [ 'enabled' => false, 'username' => env('ARTISAN_PLAYGROUND_USERNAME', 'admin'), 'password' => env('ARTISAN_PLAYGROUND_PASSWORD', 'password'), ], ],
Command Groups
Commands are automatically grouped into categories:
- Default: Standard Laravel commands
- Custom: Your application's custom commands
- Dangerous: Commands that can affect system stability
- Database: Database-related commands
- Cache: Cache management commands
Dangerous Commands
Configure which commands are considered dangerous:
'dangerous_commands' => [ 'migrate:fresh', 'migrate:reset', 'db:wipe', 'config:clear', 'cache:clear', // Add more as needed ],
UI Settings
'ui' => [ 'theme' => [ 'default' => 'light', // light, dark, auto 'allow_switch' => true, ], 'layout' => [ 'sidebar_position' => 'left', 'sidebar_collapsible' => true, 'show_command_history' => true, 'max_history_items' => 50, ], ],
๐ Security
Role-Based Access Control
The package creates three default roles:
- artisan-playground-super-admin: Full access to all features
- artisan-playground-admin: Can execute dangerous commands and manage history
- artisan-playground-user: Can execute safe commands only
Permissions
artisan-playground.view: View the dashboardartisan-playground.execute: Execute commandsartisan-playground.execute-dangerous: Execute dangerous commandsartisan-playground.delete: Delete command historyartisan-playground.restore: Restore deleted commandsartisan-playground.force-delete: Permanently delete commands
IP Restrictions
Configure allowed IP addresses in the configuration:
'allowed_ips' => [ '127.0.0.1', // Single IP '192.168.1.*', // Wildcard pattern '10.0.0.0/24', // CIDR notation '*', // Allow all IPs ],
๐จ Usage
Accessing the Interface
Visit /artisan-playground in your browser after installation.
Executing Commands
- Browse Commands: Navigate through command groups in the sidebar
- Select Command: Click on any command to view its details
- Configure Parameters: Fill in required arguments and optional parameters
- Execute: Click "Execute Command" to run the command
- View Output: See real-time output and execution time
Command History
- View all executed commands with details
- Filter by command name, user, status, or type
- Re-execute commands with the same parameters
- View full command output in modals
Theme Switching
Click the theme toggle button in the top-right corner to switch between light and dark themes.
๐ง Customization
Adding Custom Command Groups
'command_groups' => [ 'my-custom-group' => [ 'name' => 'My Custom Commands', 'description' => 'Custom application commands', 'icon' => 'fas fa-star', 'color' => 'warning', ], ],
Customizing Dangerous Commands
'dangerous_commands' => [ // Add your custom dangerous commands 'my-app:reset-data', 'my-app:clear-cache', ],
Custom Styling
Override the default styles by publishing the assets and modifying:
public/vendor/artisan-playground/css/app.csspublic/vendor/artisan-playground/js/app.js
๐ API Endpoints
The package provides several API endpoints:
GET /artisan-playground- DashboardGET /artisan-playground/command/{name}- Command detailsPOST /artisan-playground/execute- Execute commandGET /artisan-playground/history- Command historyGET /artisan-playground/login- Login pagePOST /artisan-playground/login- AuthenticatePOST /artisan-playground/logout- Logout
๐งช Testing
# Run the package tests composer test # Run with coverage composer test -- --coverage
๐ค Contributing
We welcome contributions! Please follow these steps:
1. Fork the Repository
Fork the repository on GitHub.
2. Create a Feature Branch
git checkout -b feature/amazing-feature
3. Make Your Changes
- Follow PSR-12 coding standards
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass
4. Commit Your Changes
git commit -m 'Add amazing feature'
5. Push to the Branch
git push origin feature/amazing-feature
6. Create a Pull Request
Submit a pull request with a clear description of your changes.
Development Setup
- Clone the repository
- Install dependencies:
composer install - Copy
.env.exampleto.envand configure - Run migrations:
php artisan migrate - Install the package:
php artisan artisan-playground:install
Code Style
- Follow PSR-12 coding standards
- Use meaningful variable and function names
- Add proper PHPDoc comments
- Keep functions small and focused
Testing Guidelines
- Write unit tests for all new features
- Ensure test coverage is maintained
- Test both success and failure scenarios
- Mock external dependencies
๐ Changelog
v1.0.0
- Initial release
- Bootstrap-based UI with theme support
- Role-based access control
- Command execution and history
- IP-based restrictions
- Custom authentication support
๐ License
This package is open-sourced software licensed under the MIT license.
๐ Acknowledgments
- Laravel - The PHP framework
- Bootstrap - CSS framework
- Font Awesome - Icons
- Spatie Laravel Permission - Permission management
๐ Support
- GitHub Issues: Report bugs or request features
- Documentation: Full documentation
- Buy me a coffee: Support the project
โญ Star the Repository
If you find this package useful, please consider starring the repository on GitHub!
Made with โค๏ธ by Salih Kozhinhikkodan