corporateip/laravel-api-response 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

corporateip/laravel-api-response

最新稳定版本:1.0.7

Composer 安装命令:

composer require corporateip/laravel-api-response

包简介

A simple api response factory for Laravel

README 文档

README

This package aims to makes responses from the API consistent and easy to use. It is compliant with the HTTP standard and the JSend standard.

Example

Code

function getUser($id){
    // Get the data we wish to return
    $user = User:find($id);
    
    // If the user does not exist we return an error
    if(!$user){
        return ApiResponseFactory::notFound("User does not exist");
    }
    
    // Return the data by using a ReponseFactory
    return ApiResponseFactory::success($user);
}

Error output

{
  "status":"fail",
  "message":"User does not exist"
}

Success output

{
  "status":"success",
  "data": { 
      "id":1,
      "name":"John Doe",
      "email":"john@example.org",
      "created_at":null,
      "updated_at":null
  }
}

Installation

To install you can use Composer, use the following command to install this package.
composer require corporateip/laravel-api-response

Documentation

Coming soon!

Progress

  • JSend compliance
  • PHPUnit tests
  • Documentation

License

For the license please check the LICENSE file, this project has the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固