定制 siriusphp/invokator 二次开发

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

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

siriusphp/invokator

最新稳定版本:1.1.1

Composer 安装命令:

composer require siriusphp/invokator

包简介

Library that implements a unified way to execute a list of commands/callables that are used by various patterns: events, pipelines, middleware etc

README 文档

README

Source Code Latest Version Software License Build Status Total Downloads

Sirius Invokator is a library that implements a unified way to execute a list of commands/callables that are used by various patterns:

  1. middlewares
  2. pipelines
  3. events
  4. command bus (with middleware)
  5. actions a la Wordpress
  6. filters a la Wordpress

All of the above patterns have in common that they are actually a list of callables, and they differ in the way they are executed in different ways.

In the case of middlewares, the starting parameter (eg: a HTTP request) is passed from one callable to the next, each callable having the option to terminate with a result or call the next callable in the list.

In the case of pipelines, the result of each callable is passed to the next callable and the last callable will return the result of the pipeline

In the case of events, an event object is passed through each callable in the list and each callable is independent.

In th case of the command buss, a command object is sent to be handled by only one callable.

Elevator pitch

use Sirius\Invokator\Invoker;
use Sirius\Invokator\Processors\PipelineProcessor;
use Sirius\Invokator\CallableCollection;

$container = app(); // your application DI container
$invoker = new Invoker($container)
$processor = new PipelineProcessor($invoker);

$processor->add('pipeline_name', 'trim');
$processor->add('pipeline_name', 'Str::toUppercase');
$processor->add('pipeline_name', function($value) {             // anonymous function
    return $value . '!!!';
});
$processor->add('pipeline_name', 'Logger@info');

$processor->process('pipeline_name', "  hello world  "); // returns `HELLO WORLD!!!`

Where to next?

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固