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

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

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

aelnemr/api-response

最新稳定版本:v1.2.2

Composer 安装命令:

composer require aelnemr/api-response

包简介

This package will handle restful api response

README 文档

README

CoreJsonResponse JSON response trait. This trait makes it easy for any controller to return a JSON response with the appropriate HTTP status code.

Install via composer ????

composer require aelnemr/api-response 

Usage

All that you need is to use the CoreJsonResponse trait inside your controller.

Example:

<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use AElnemr\RestFullResponse\CoreJsonResponse; class CountryController extends Controller { use CoreJsonResponse; public function index() { $data = \App\User::get(); return $this->ok($data); } }

Available methods

Success Methods ✌️

Method Status code Description
ok 200 Successful get, patch (return a JSON object)
okWithPagination 200 Successful get, patch (return a JSON object)
created 201 Successful post (return a JSON object)

Error Status ????

Method Status code Description
unauthenticated 401 Error Not authenticated
forbidden 403 Error Not authorized (Authenticated, but no permissions)
notFound 404 Error Not Found
invalidRequest 422 Error Validation

Extra methods ????

Method Status code Description
accepted 202 Successful post, delete, path - async
badRequest 400 Error The request could not be understood by the server due to malformed syntax
paymentRequired 402 Error Payment required
conflict 409 Error Logical error

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固