hexafuchs/laravel-dynamic-artisan-commands 问题修复 & 功能扩展

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

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

hexafuchs/laravel-dynamic-artisan-commands

最新稳定版本:v0.1.0

Composer 安装命令:

composer require hexafuchs/laravel-dynamic-artisan-commands

包简介

Library for dynamic replacement of artisan commands

README 文档

README

Latest Version on Packagist Total Downloads

This package aims to deliver a universal interface to replace artisan commands. Sadly, the original package leaves not much possibility to do this. I wanted to create something that does not crash when others want to overwrite these commands as well and is reusable.

[!WARNING] Please note that this library is in beta stage. Any feedback is welcome. Currently, we are primarily worried if the order of the providers could prevent the commands from being registered. Please feel free to open issues.

Installation

You can install the package via composer:

composer require hexafuchs/laravel-dynamic-artisan-commands

Usage

Within your register() method, add the following snippet. (If you use the spatie package helper, overwrite the registeringPackage() function)

DynamicArtisanServiceProvider::registerCommand('CommandName', CommandNameCommand::class, NewCommandNameCommand::class, false);

The first argument is the name of the command. If your command goes like command:name, you should write this in UpperCamelCase notation, i.e. CommandName. Have a look at \Illuminate\Foundation\Providers\ArtisanServiceProvider for a list of all existing command names.

If you want to overwrite an existing command, the second argument is the original command class and the third argument is either your new command class that extends the original command class, or a closure that initializes an object of your new command class.

If you want to create a new command instead, the second argument is your command class, and the third argument is either null or a closure that initializes an object of your command class.

The fourth argument is used to define a dev command instead of a normal command. I left this possibility in here, note that there seems to be no functional difference between these types. Most likely they are only used for semantic separation of commands.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-30