slabphp/sequencer
Composer 安装命令:
composer require slabphp/sequencer
包简介
SlabPHP Sequencer
关键字:
README 文档
README
The Sequencer library is used to create re-usable class hierarchies of controllers. Methods are added to the sequencer so child controllers can add additional items to the sequence. The SlabPHP framework leverages these for most controllers.
SlabPHP was built many years ago, we're well aware about the distaste for protected members. For more information about SlabPHP, time travel, deprecation, life, love, and other things, please see the main SlabPHP framework documnetation.
Example
Lets pretend we have a parent class that looks like this:
<?php
class Parent
{
/**
* @var \Slab\Sequencer\CallQueue
*/
protected $sequence;
/**
* @var int
*/
protected $value = 0;
/**
* Public constructor
*/
public function __construct()
{
$this->sequence = new \Slab\Sequencer\CallQueue();
$this->value = 1;
}
/**
* This adds the "doSomethingAlways" method to the Sequencer call queue but does not actually run it yet
*/
public function setSequence()
{
$this->sequence
->doSomethingAlways();
}
/**
* Multiply value by 2
*/
public function doSomethingAlways()
{
$this->value *= 2;
}
/**
* Actually run the functions in the sequence and echo the output
*/
final public function execute()
{
$this->sequence->execute($this);
echo $this->value;
}
}
And you use this as your controller all over the place. But you want to make a similar controller with an additional action. You could extend it as follows:
<?php
class Child extends Parent
{
/**
* Overload and extend the setSequence function
*/
public function setSequence()
{
parent::setSequence();
$this->sequence
->doSomethingElse();
}
/**
* Multiply the value again by 3
*/
public function doSomethingElse()
{
$this->value *= 3;
}
}
If you were to do the following:
$parent = new Parent();
$parent->execute(); //echos 2
But if you do:
$child = new Child();
$child->execute(); //echos 6
slabphp/sequencer 适用场景与选型建议
slabphp/sequencer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 88 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 03 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「slab」 「Sequencer」 「slabphp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 slabphp/sequencer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 slabphp/sequencer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 slabphp/sequencer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Alfabank REST API integration
The Slab framework. The core functionality to make your site better.
SlabPHP File and Resource Concatenator
SlabPHP Controller Library
SlabPHP Bundle Stack Management Library
SlabPHP Display and Templating Library
统计信息
- 总下载量: 88
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2018-03-02