定制 hesto/fractalfy 二次开发

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

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

hesto/fractalfy

Composer 安装命令:

composer require hesto/fractalfy

包简介

Laravel wrapper for Fractal.

README 文档

README

Laravel Wrapper for Fractal

Usage

Step 1: Install Through Composer

composer require hesto/fractalfy

Step 2: Register Service Provider

Add your new provider to the providers array of config/app.php:

  'providers' => [
      // ...
      Hesto\Fractalfy\FractalfyServiceProvider::class,
      // ...
  ],

Fractal methods

Extend your controller with FractalfyController

class DashboardController extends FractalfyController
{
    ...
}

Return collection

$users = Users::all();
return $this->fractal
    ->collection($users, new UserTransformer)
    ->get();

Return resource with pagination

$users = Users::all();
return $this->fractal
    ->paginate($users, new UserTransformer)
    ->get();

Fractalfy Helpers

Use Fractalfy Helpers (already included in FractalfyController)

Popular

return $this->respondOK();
return $this->respondNotFound();
return $this->respondUnauthorized();
return $this->respondUnprocessable();
return $this->respondBadRequest();
return $this->respondWithSuccess(200); //any success code
return $this->respondWithError(400); //any success code

Other

return $this->respondOK($message); //pass message to respond
return $this->setMessage($message)->respondOK();
return $this->setMessage($message)->setStatusCode($statuscode)->respondWithSuccess(); 
return $this->setMessage($message)->setStatusCode($statuscode)->respondWithError(); 

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固