定制 murilochianfa/laravel-command-blocker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

murilochianfa/laravel-command-blocker

最新稳定版本:v1.0.1

Composer 安装命令:

composer require murilochianfa/laravel-command-blocker

包简介

Block selected commands in specific environments

README 文档

README

The Laravel Command Blocker package provides a seamless solution for hiding and block Laravel commands in specific environments, enhancing the security and control of your Laravel applications.

Banner

Features

  • Environment-Based Command Visibility: Easily configure the package to hide and/or block specific Laravel commands based on the application's environment.

  • Enhanced Security: Prevent development or sensitive commands from being visible and/or executable in production or other critical environments.

  • Straightforward Configuration: Simple configuration settings in your Laravel application make it easy to manage command visibility.

Installation

You can install the package via Composer:

composer require murilochianfa/laravel-command-blocker

Next, publish the configuration file:

php artisan vendor:publish --provider="MuriloChianfa\LaravelCommandBlocker\CommandBlockerServiceProvider"

Dependencies

  • Laravel 10.0 or higher.
  • PHP 8.2 or higher.

Configuration

Open the generated configuration file (config/laravel-command-blocker.php) and set up the environments and commands you want to hide or block:

<?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',
        ],
    ],

];

Commitment to Quality

During package development, try as best as possible to embrace good design and development practices to try to ensure that this package is as good as it can be. The checklist for package development includes:

  • ✅ Be fully PSR4 and PSR12 compliant.
  • ✅ Include comprehensive documentation in README.md.
  • ✅ Have no PHPCS warnings throughout all code.

Testing

composer style

Security

If you discover any security related issues, please email murilo.chianfa@outlook.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 2.84k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-02