定制 desmart/adr 二次开发

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

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

desmart/adr

Composer 安装命令:

composer require desmart/adr

包简介

ADR pattern implementation for Laravel. Designed for https://github.com/DeSmart/laravel-vanilla.

README 文档

README

ADR pattern implementation for Laravel. The package provides a set of tools making it easier to implement the Action-Domain-Responder pattern.

Installation

Install package using Composer:

composer require desmart/adr

Register the package's service provider in config/app.php:

'providers' => [
        (...)
        DeSmart\ADR\ServiceProvider::class,
    ],

Usage

The main goal of this package is to make it easier to implement the ADR pattern. This means that you should be able to create Actions (Controllers with a single callable method, e.g. execute()) that return a Responder.

The Responder can digest a single Entity or a Collection of Entities and transform them into a JSON API response.

Example

class ADRAction extends \DeSmart\ADR\Actions\BaseAction
{
    public function execute()
    {
        $user = new User('John', 'john@desmart.com');

        return $this->respondWith($user);
    }
}

Model to Entity hydration

In order to hydrate an entity from a model (and vice versa) the package comes with a helper - HydratesEntityTrait.

Each Model class that uses this trait will be granted the toEntity() method which converts the Model to an Entity.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固