kozhinhikkodan-dev/artisan-playground 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kozhinhikkodan-dev/artisan-playground

Composer 安装命令:

composer require 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

README 文档

README

A beautiful, secure, and feature-rich UI for executing Laravel Artisan commands with role-based access control, theme support, and comprehensive command management.

Artisan Playground PHP License GitHub Stars Packagist Downloads Packagist Stars Latest Version

✨ 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:

  1. artisan-playground-super-admin: Full access to all features
  2. artisan-playground-admin: Can execute dangerous commands and manage history
  3. artisan-playground-user: Can execute safe commands only

Permissions

  • artisan-playground.view: View the dashboard
  • artisan-playground.execute: Execute commands
  • artisan-playground.execute-dangerous: Execute dangerous commands
  • artisan-playground.delete: Delete command history
  • artisan-playground.restore: Restore deleted commands
  • artisan-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

  1. Browse Commands: Navigate through command groups in the sidebar
  2. Select Command: Click on any command to view its details
  3. Configure Parameters: Fill in required arguments and optional parameters
  4. Execute: Click "Execute Command" to run the command
  5. 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.css
  • public/vendor/artisan-playground/js/app.js

📊 API Endpoints

The package provides several API endpoints:

  • GET /artisan-playground - Dashboard
  • GET /artisan-playground/command/{name} - Command details
  • POST /artisan-playground/execute - Execute command
  • GET /artisan-playground/history - Command history
  • GET /artisan-playground/login - Login page
  • POST /artisan-playground/login - Authenticate
  • POST /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

  1. Clone the repository
  2. Install dependencies: composer install
  3. Copy .env.example to .env and configure
  4. Run migrations: php artisan migrate
  5. 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

📞 Support

⭐ Star the Repository

If you find this package useful, please consider starring the repository on GitHub!

Made with ❤️ by Salih Kozhinhikkodan

kozhinhikkodan-dev/artisan-playground 适用场景与选型建议

kozhinhikkodan-dev/artisan-playground 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 32 次下载、GitHub Stars 达 18, 最近一次更新时间为 2025 年 07 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「admin」 「ui」 「theme」 「bootstrap」 「commands」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 kozhinhikkodan-dev/artisan-playground 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 kozhinhikkodan-dev/artisan-playground 我们能提供哪些服务?
定制开发 / 二次开发

基于 kozhinhikkodan-dev/artisan-playground 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 32
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 19
  • 点击次数: 20
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 18
  • Watchers: 0
  • Forks: 1
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-12