承接 matthis/chief 相关项目开发

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

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

matthis/chief

最新稳定版本:v1.4.0

Composer 安装命令:

composer require matthis/chief

包简介

A simple command bus

README 文档

README

Build Status

A simple Command bus.

Installation

Install via composer.

composer require "matthis/chief:1.2.*"

Usage

Executing a command is as simple as:

<?php 

$commandBus = new matthis\Chief\CommandBus();

$myCommand = new RegisterUserCommand('John Doe', 'john@doe.com');
$commandBus->execute($myCommand);

Chief expects the following naming convention:

The commands should end with "Command".

Example command:

<?php

class RegisterUserCommand
    public function __construct($username, $email)
    {
        $this->username = $username;
        $this->email = $email;
    }
}

For Chief to map the command to a command handler the handler should have the same name as the command and have "Handler" appended to it.

Example command handler:

<?php

class RegisterUserCommandHandler
{
    public function handle($command)
    {
        $command->username; //John Doe
        $command->email; //john@doe.com
    }
}

Tests

vendor/bin/phpspec run

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-22