承接 mrjulio/rapture-adr 相关项目开发

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

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

mrjulio/rapture-adr

Composer 安装命令:

composer require mrjulio/rapture-adr

包简介

Rapture ADR component

关键字:

README 文档

README

PhpVersion License

Action-Domain-Responder pattern implementation

More info here: https://github.com/pmjones/adr

Requirements

  • PHP v7.0
  • php-json

Install

composer require mrjulio/rapture-adr

Quick start

# action

namespace Demo\Action\User;

class View extends Action
{
    public function __invoke():array
    {
        $userId = $this->request()->getAttribute('id');
        
        $user = \Demo\Domain\Model\UserQuery::create()
            ->filterById($userId)
            ->findOne();
            
        if (!$user) {
            throw new HttpNotFoundException('User not found');
        }

        return [
            'user' => $user
        ];
    }
}

# Responder

namespace Demo\Responder\User;

class View extends Responder
{
    // demo
    public function preInvoke(array $data)
    {
        $this->template = new Template($this->getTemplateName(), $data);
    }
    
    // demo
    public function __invoke(array $data)
    {
        $stream = new Stream(fopen('php://memory', 'r+'));
        $stream->write($this->template->render());

        $this->response->withBody($stream)->send();
    }
}

# Dispatcher

(new Dispatcher('Demo', $router))->dispatch($request, $response);

About

Author

Iulian N. rapture@iuliann.ro

Credits

License

Rapture PHP ADR is licensed under the MIT License - see the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固