定制 cerbero/json-api-error 二次开发

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

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

cerbero/json-api-error

最新稳定版本:0.5.0

Composer 安装命令:

composer require cerbero/json-api-error

包简介

Laravel package to standardize API errors in compliance with the JSON:API spec.

README 文档

README

Author PHP Version Laravel Version Build Status Coverage Status Quality Score PHPStan Level Total Downloads Latest Version Software License PER

{
  "errors": [
    {
      "status": "422",
      "title": "Unprocessable Content",
      "detail": "The name field must be a string.",
      "source": {
        "pointer": "/name"
      }
    },
    {
      "status": "422",
      "title": "Unprocessable Content",
      "detail": "The name field must be at least 2 characters.",
      "source": {
        "pointer": "/name"
      }
    }
  ]
}

Laravel package to standardize API error responses in compliance with the JSON:API spec, providing:

  • consistency: ensure uniform API error responses across all Laravel apps, adhering to a widely used standard
  • automation: handle Laravel-specific and common HTTP exceptions automatically
  • simplicity: focus solely on error responses without the need to implement the full JSON:API spec
  • zero configuration: install the package with no additional configuration required
  • customization: optionally register custom handlers, map errors to HTTP statuses or merge default data
  • localization: translate JSON:API errors into any language
  • testability: test error responses using the built-in testing tools
  • debugging: inspect the original message and trace when an unexpected error occurs

📦 Install

Via Composer:

composer require cerbero/json-api-error

🔮 Usage

Note

Work in progress... 🏗️

  • implement links
  • write documentation
  • reach 100% code coverage
  • tag stable version

📆 Change log

Please see CHANGELOG for more information on what has changed recently.

🧪 Testing

composer test

💞 Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

🧯 Security

If you discover any security related issues, please email andrea.marco.sartori@gmail.com instead of using the issue tracker.

🏅 Credits

⚖️ License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固