emir/laravel-webartisan
Composer 安装命令:
composer require emir/laravel-webartisan
包简介
A beautiful browser-based terminal to run Laravel Artisan commands
README 文档
README
A beautiful, modern browser-based terminal for running Laravel Artisan commands. Zero dependencies on the frontend, just works.
Features
- Run any Artisan command from your browsers
- Tab completion for command names
- Command history with up/down arrow navigation
- 4 built-in themes: Dark, Light, Monokai, Dracula
- Security: Environment restriction, Gate authorization, command allow/block lists
- Wildcard patterns for command filtering (
migrate:*,db:*) - Artisan install command for quick setup
- Zero configuration needed - works out of the box
- Supports Laravel 10, 11, and 12
Requirements
- PHP 8.2+
- Laravel 10.x, 11.x, or 12.x
Installation
composer require emir/laravel-webartisan --dev
The package uses Laravel's auto-discovery, so the service provider is registered automatically.
Run the install command to publish config and assets:
php artisan webartisan:install
That's it! Visit /webartisan in your browser.
Manual Publishing
If you prefer to publish resources individually:
# Config file php artisan vendor:publish --tag=webartisan-config # Frontend assets php artisan vendor:publish --tag=webartisan-assets # Blade views (for customization) php artisan vendor:publish --tag=webartisan-views
Configuration
After publishing, the config file is located at config/webartisan.php:
return [ // Master switch 'enabled' => env('WEBARTISAN_ENABLED', true), // Only available in these environments 'enabled_environments' => ['local'], // URL prefix (accessible at /webartisan) 'route_prefix' => env('WEBARTISAN_PREFIX', 'webartisan'), // Restrict to a specific domain 'domain' => env('WEBARTISAN_DOMAIN', null), // Route middleware 'middleware' => ['web'], // Gate-based authorization (see Security section) 'gate' => null, // Only allow these commands (empty = all except blocked) 'allowed_commands' => [], // Always block these commands 'blocked_commands' => [ 'down', 'up', 'env', 'serve', 'tinker', 'key:generate', 'migrate:fresh', 'migrate:reset', 'db:wipe', 'db:seed', ... ], // Terminal theme: 'dark', 'light', 'monokai', 'dracula' 'theme' => env('WEBARTISAN_THEME', 'dark'), ];
Usage
Terminal Commands
| Command | Description |
|---|---|
help |
Show available terminal commands |
list |
List all artisan commands with descriptions |
clear |
Clear the terminal screen |
exit / quit |
Leave webartisan |
Type any Artisan command directly:
❯ route:list
❯ migrate:status
❯ make:model Post --migration --factory
❯ config:show database
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Tab |
Autocomplete command names |
Up / Down |
Navigate command history |
Ctrl+L |
Clear terminal |
Themes
Set the theme in your config or .env file:
WEBARTISAN_THEME=dracula
Available themes: dark (default), light, monokai, dracula.
Security
Webartisan is designed for development use only. Multiple security layers are built in:
1. Environment Restriction (Default)
By default, Webartisan is only available in the local environment:
'enabled_environments' => ['local'],
2. Master Switch
Disable completely via environment variable:
WEBARTISAN_ENABLED=false
3. Gate Authorization
For fine-grained access control, define a gate in your AppServiceProvider:
use Illuminate\Support\Facades\Gate; Gate::define('viewWebartisan', function ($user) { return in_array($user->email, [ 'admin@example.com', ]); });
Then enable it in the config:
'gate' => 'viewWebartisan', 'middleware' => ['web', 'auth'], // Add auth middleware
4. Custom Authorization
Use the Webartisan::auth() method in your AppServiceProvider:
use Emir\Webartisan\Webartisan; Webartisan::auth(function ($request) { return $request->user()?->isAdmin() ?? false; });
5. Command Allow/Block Lists
// Only allow specific commands 'allowed_commands' => ['route:list', 'migrate:status', 'queue:*'], // Block dangerous commands (supports wildcards) 'blocked_commands' => ['db:*', 'migrate:fresh', 'tinker'],
6. Domain Restriction
Restrict to an internal domain:
WEBARTISAN_DOMAIN=admin.myapp.test
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Credits
- Emir Karşıyakalı
- Inspired by samdark/yii2-webshell
- Built with jQuery Terminal
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
emir/laravel-webartisan 适用场景与选型建议
emir/laravel-webartisan 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 543 次下载、GitHub Stars 达 56, 最近一次更新时间为 2015 年 08 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「browser」 「console」 「terminal」 「laravel」 「artisan」 「Devtools」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 emir/laravel-webartisan 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 emir/laravel-webartisan 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 emir/laravel-webartisan 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This class provides you with an easy-to-use interface to progress bars.
Give your JS App some Backbone with Models, Views, Collections, and Events.
A Laravel package to retrieve data from Google Search Console
A fork of runcmf/runtracy
Additional artisan commands for Laravel
PHP Terminal emulator controller utilizing ANSI escape sequence coding.
统计信息
- 总下载量: 543
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 56
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-09