Download the PHP package felo-z/laravel-api-response without Composer

On this page you can find all versions of the php package felo-z/laravel-api-response. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-api-response

Laravel API Response

Laravel 13+ 统一 API 响应与异常处理扩展包。

要求

安装

发布配置(可选,包已内置默认配置):

快速使用

响应结构

成功响应示例:

失败响应示例(有错误详情时):

字段 说明
status 业务状态(true / false),满足 status === (code === 0)
code 业务码0 = 成功;1000–1999 = 包内置 ApiCode;其它整数 = 项目自定义
message 提示文案
data 成功数据(失败时为 null
error 可选;生产环境会隐藏系统堆栈类诊断信息

HTTP 状态码在传输层独立存在,不写入 body code204 / 205 无响应 body。

异常自动接管

安装后通过 ApiResponseServiceProvider 注册 render_using,对以下请求自动将未捕获异常转为统一 JSON:

业务代码只需 throw,无需手动 return api_response()->exception(...)

文档

文档 说明
api-response.md 完整使用手册
api-response-examples.md Controller / 验证 / 异常接入示例
api-response-project-extension.md 项目自建业务码常量
api-response-frontend-quick.md 前端判定规则
api-response-contract-template.md 前后端协作约定模板
api-response-production-template.md 生产环境配置模板
api-response-benchmark.md pipes 性能压测
api-response-upgrade.md v1 → v2 升级说明

变更记录见 CHANGELOG.md。

开发

License

MIT


All versions of laravel-api-response with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
laravel/framework Version ^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package felo-z/laravel-api-response contains the following files

Loading the files please wait ...