定制 regnerisch/laravel-command-hooks 二次开发

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

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

regnerisch/laravel-command-hooks

最新稳定版本:2.0.0

Composer 安装命令:

composer require regnerisch/laravel-command-hooks

包简介

README 文档

README

This package adds a before and after hook to Laravels command class.

Usage

The methods are only called if they are defined inside you class. If you do not need them, do not implement them. Returning a none zero value inside you before method will exit the execution immediately. Neither handle/ __invoke nor the after method will be called. The after method will get the exit code of the executed handle/ __invoke method, you can manipulate the exit code inside the after method and overwrite it by returning you own exit code. Returning null or nothing will keep the original exit code.

use \Regnerisch\LaravelCommandHooks\Command;

class MyCustomCommand extends Command
{
    protected function before(): ?int
    {
        // Do something before the command
        
        return $code;
    }
    
    protected function after(int $code): ?int
    {
        // Do something after the command
        
        return $code;
    }
    
    // ...
}

Contributors

License

ISC

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: ISC
  • 更新时间: 2022-09-20