定制 sparhandy/pipeandfilter 二次开发

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

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

sparhandy/pipeandfilter

最新稳定版本:1.0.1.1

Composer 安装命令:

composer require sparhandy/pipeandfilter

包简介

Pipe and Filter Architecture

README 文档

README

Build Status Github Releases Release Packagist

PipeAndFilter

This repository contains all necessary files to use the Pipe & Filter Architecture in PHP.

Installation with composer

composer require "sparhandy/pipeandfilter"

Usage

PipeFactory

<?php 
// Implements \Sparhandy\PipeAndFilter\FilterInterface
$exampleFilterFoo = new Acme\Filter\Foo(); 
$exampleFilterBar = new Acme\Filter\Bar(); 
$exampleFilterBaz = new Acme\Filter\Baz(); 

$filters = [
  $exampleFilterFoo,  
  $exampleFilterBar,  
  $exampleFilterBaz,  
];

$factory = new \Sparhandy\PipeAndFilter\PipeFactory();
$pipe = $factory->build($filters);

// The variable, to be processed by the $filters
$context = [];

// The context, to be processed by the $filters
$someParameter = [
    'foo' => 'bar',
];

$pipe->run($context, $someParameter);

// $context is now modified by your filters.
?>

Filter

<?php 

class FooFilter implements Sparhandy\PipeAndFilter\FilterInterface
{
    /**
     * @param mixed   $context
     * @param mixed[] $someParameter
     *
     * @return void
     */
    public function execute(&$context, array $someParameter)
    {
        if (isset($context['foo']))
        {
            $context['bar'] = $someParameter['baz'];
        }
    }
}
?>

How to contribute

If you want to contribute to the standard here is how it works.

  • Create a fork of Sparhandy/PipeAndFilter.
  • Create your branch from master and commit your changes.
  • Push your branch to your fork.
  • Create a pull request on GitHub.
  • Discuss your pull request with us.
  • Our devs will then merge or close the pull request.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2017-12-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固