定制 fasberg/prettyresponse 二次开发

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

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

fasberg/prettyresponse

Composer 安装命令:

composer require fasberg/prettyresponse

包简介

A helper for creating pretty api responses or just wrapping resources

README 文档

README

Installation

composer require fasberg/prettyresponse

Usage

use Fasberg\PrettyResponse\Facade\PrettyResponseFacade as PrettyResponse;

...

return PrettyResponse::wrap($resource, $options);

return PrettyResponse::conditional($condition, $resource, $options);

Wrap

Will take an array, collection or resource and wrap it in the base success response

Conditional

Conditional variable can be boolean, Closure or Collection.

It will default to trying to convert input into a boolean.

Data should be in the form of an array, collection or resource.

Options allows you to set a custom error/success message and return code

$options = [
    'error' => [
        'message' => 'My error message',
        'code' => 123
    ],
    'success' => [
        'message' => 'My success message',
        'code' => 321
    ]
];

Configuration

There is a configuration file available that will allow you to set global defaults.

Publish it by running

php artisan vendor:publish --provider="Fasberg\PrettyResponse\PrettyResponseServiceProvider"

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固