murilochianfa / laravel-command-blocker
在特定环境中阻止选定的命令
v1.0.1
2023-12-02 19:28 UTC
Requires
- php: ^8.0
- ext-json: *
- illuminate/console: ^9.0 | ^10.0 | ^11.0
- illuminate/support: ^9.0 | ^10.0 | ^11.0
Requires (Dev)
README
Laravel Command Blocker 包为隐藏和阻止特定环境中 Laravel 命令提供了一种无缝的解决方案,增强了您 Laravel 应用的安全性和控制能力。
功能
-
基于环境的命令可见性:轻松配置包以根据应用的环境隐藏和/或阻止特定的 Laravel 命令。
-
增强的安全性:防止开发或敏感命令在生产环境或其他关键环境中可见和/或可执行。
-
直观的配置:在 Laravel 应用中简单的配置设置可以轻松管理命令可见性。
安装
您可以通过 Composer 安装此包
composer require murilochianfa/laravel-command-blocker
接下来,发布配置文件
php artisan vendor:publish --provider="MuriloChianfa\LaravelCommandBlocker\CommandBlockerServiceProvider"
依赖项
- Laravel 10.0 或更高版本。
- PHP 8.2 或更高版本。
配置
打开生成的配置文件(config/laravel-command-blocker.php),设置您要隐藏或阻止的环境和命令
<?php return [ /* |-------------------------------------------------------------------------- | Decids if hide the commands |-------------------------------------------------------------------------- | | Here you can decide if hide commands in their environments from the command list. | | Supported: "true", "false" | */ 'hide' => true, /* |-------------------------------------------------------------------------- | Decids if block the commands |-------------------------------------------------------------------------- | | Here you can decide if block commands from execution in their environments. | or if only hide in the command list | | Supported: "true", "false" | */ 'block' => true, /* |-------------------------------------------------------------------------- | Environments commands to block |-------------------------------------------------------------------------- | | This option controls which commands will be blocked in certain environments. | */ 'environments' => [ /** * Hide development commands in production environments. */ 'production' => [ 'cache:table', 'clear-compiled', 'db', 'db:seed', 'db:wipe', 'docs', 'event:generate', 'inspire', 'key:generate', 'lang:publish', 'make:cast', 'make:channel', 'make:command', 'make:component', 'make:controller', 'make:event', 'make:exception', 'make:factory', 'make:job', 'make:listener', 'make:mail', 'make:middleware', 'make:migration', 'make:model', 'make:notification', 'make:observer', 'make:policy', 'make:provider', 'make:request', 'make:resource', 'make:rule', 'make:scope', 'make:seeder', 'make:test', 'make:view', 'migrate:fresh', 'migrate:install', 'migrate:refresh', 'migrate:reset', 'notifications:table', 'package:discover', 'queue:batches-table', 'queue:failed-table', 'queue:table', 'schema:dump', 'serve', 'session:table', 'stub:publish', 'test', 'tinker', 'vendor:publish', ], ], ];
质量承诺
在包开发过程中,尽可能地采用良好的设计和开发实践,以确保本包尽可能出色。包开发清单包括
- ✅ 完全遵守 PSR4 和 PSR12。
- ✅ 在 README.md 中包含全面的文档。
- ✅ 所有代码中没有 PHPCS 警告。
测试
composer style
安全
如果您发现任何与安全相关的问题,请通过电子邮件 murilo.chianfa@outlook.com 联系,而不是使用问题跟踪器。
鸣谢
许可证
MIT 许可证(MIT)。有关更多信息,请参阅许可证文件。
