承接 knplabs/minibus 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

knplabs/minibus

最新稳定版本:0.0.1-beta

Composer 安装命令:

composer require knplabs/minibus

包简介

Minibus is a simple implementation of a workflow bus.

README 文档

README

minibus

Hey welcome to you traveler! You are looking for a way of traveling through your software easily? Do not search anymore, you've just find the place!

Ladies and gentleman, let me present you the famous, the incredible, the revolutionary PHP Minibus !

The goal

If you are like me, you are probably coding software solutions. In many software architectures the story starts with an Entry point (cf: a controller in an MVC application). But if you think about this Entry Point you probably agree with me that it's not only one point but, in many cases, a mix of many components that interact between them!

In order to avoid what I call SMFB architecture (understand: Super Mega Fuc**** Brain, as the Controller) I present you Minibus!

The principle is simple. In order to handle an application Entry Point we need three components:

  • A Minibus, which contains various passengers (understand data).
  • Some Stations, that can handle a minibus at some point (replace the controller).
  • A bus Line that contains Stations and can guide a Minibus.
  • Optionaly a Terminus that can handle how to display the passengers.

Cool! Let's rock!

A basic example would be somethong like this:

use Knp\Minibus\Station;
use Knp\Minibus\Minibus;

class CrazyStation implements Station
{
    public function handle(Minibus $minibus, array $configuration = [])
    {
        // You can add passenger
        $minibus->addPassenger('Sheldon', ['name' => 'Cooper', 'from' => 'The Big Bang Theory']);

        // Ensure a passenger existence
        if (!$minibus->hasPassenger('Sheldon')) {
            throw new \Exception('Wow something is going wrong :/');
        }

        // Retrieve a passenger
        $from = $minibus->getPassenger('Sheldon')['from'];

        // Or add as many passengers you want
        $minibus->setPassengers([
            'George' => 'Abitbol',
        ]);
    }
}

Once you have some stations, you need to create a Minibus and a Line:

// test.php

use Knp\Minibus\Minibus\Minibus;
use Knp\Minibus\Line\Line;

$minibus = new Minibus;
$line    = new Line;

// add the station in the line
$line->addStation(new CrazyStation);

// finally lead te minibus thrue all the registered stations
$line->lead($minibus); // return the minibus

echo $minibus->getPassenger('George'); // print "Abitbol" :)

Go further

This is some other documentations that explain everything in details:

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: WTFPL
  • 更新时间: 2014-11-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固