PHPackages                             tembra/jsonapi-errors-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. tembra/jsonapi-errors-php

ActiveLibrary[API Development](/categories/api)

tembra/jsonapi-errors-php
=========================

A PHP implementation of JSON API Errors compliant format.

v0.8.0(10y ago)61.0kBSD-3-ClausePHP &gt;=5.4.0

Since Jun 30Compare

[ Source](https://github.com/tembra/jsonapi-errors-php)[ Packagist](https://packagist.org/packages/tembra/jsonapi-errors-php)[ Docs](https://github.com/tembra/jsonapi-errors-php)[ RSS](/packages/tembra-jsonapi-errors-php/feed)WikiDiscussions Synced 3d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

[![License](https://camo.githubusercontent.com/4af0b5c4deccc6775817bb0d64a094a05313d19e71192c631e3ebcebc4b194f9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f74656d6272612f6a736f6e6170692d6572726f72732d7068702e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Version](https://camo.githubusercontent.com/37a7791480e019c4ef39325d258edbe1b04420ebc604c5ba1ba085e90a5d46e0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74656d6272612f6a736f6e6170692d6572726f72732d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tembra/jsonapi-errors-php)[![Total Installs](https://camo.githubusercontent.com/9edeb4c82c10279aba43d2a2abeea0ac8b1a2fa1f4e5630e22528c42dd1933d2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74656d6272612f6a736f6e6170692d6572726f72732d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tembra/jsonapi-errors-php)[![StyleCI](https://camo.githubusercontent.com/1b32e3fea5788927356b40c75b2780ca9916be58ecd1d679db231c4c967b2164/68747470733a2f2f7374796c6563692e696f2f7265706f732f36323039323336322f736869656c64)](https://styleci.io/repos/62092362)

Description
-----------

[](#description)

[![JSON API logo](https://camo.githubusercontent.com/5a13bdb171c3e1f6fc251a70f751b4b1957b598dd08dcf265ca7867fc1fef4b1/687474703a2f2f6a736f6e6170692e6f72672f696d616765732f6a736f6e6170692e706e67 "JSON API")](http://jsonapi.org/)

This framework agnostic package implements a simple and efficient way to throw or respond errors in JSON API specification **version v1.0** as described in [JSON API Errors](http://jsonapi.org/format/#errors). It also helps creating documentation for these errors on your application. It is based on 3rd party package [`neomerx/json-api`](https://github.com/neomerx/json-api) that fully implements the [JSON API Format](http://jsonapi.org/format/).

It greatly simplifies the error processing with high code quality.

Still framework agnostic, you can easily integrate it with [Laravel/Lumen](https://laravel.com) and [Dingo API](https://github.com/dingo/api).

Milestone to v1.0
-----------------

[](#milestone-to-v10)

- Makes JSON API Errors as simple as calling a function
- Standardize the errors
- Provide most common error functions for HTTP Status Codes
- Throw an exception or return the JSON string
- Override JSON API Error Objects members
- Support for Localization
- Generate Documentation for Application Error Codes
- Build PHPUnit tests

Sample usage
------------

[](#sample-usage)

Assuming you don't want a specific class to standardize the errors and also don't want the documentation or localization, you can use as simple as this:

```
echo MyJsonApiErrors::badRequest([
  827 => [
    'title' => 'Another Error',
    'detail' => 'Detailed error description'
  ]
], false);
```

will output **as string**

```
{
  "errors": [
    {
      "status": "400",
      "code": "827",
      "title": "Another Error",
      "detail": "Detailed error description"
    }
  ]
}
```

The first parameter is an associative array where `key` is the error `code` in JSON API compliant format and `value` is another associative array where `key/value` pairs are some others members that JSON API Error Objects may have.

The second parameter `false` is to define whether a `JsonApiException` should be thrown or only the JSON string should be returned.

**For more advanced usage please check out the [Wiki](https://github.com/tembra/jsonapi-errors-php/wiki)**.

Questions?
----------

[](#questions)

Do not hesitate to contact me on  or post an [issue](https://github.com/tembra/jsonapi-errors-php/issues).

License
-------

[](#license)

BSD 3-Clause. Please see [License File](LICENSE) for more information.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3655d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/949f38e7454c8c518d79939320f3a9d35955375cc748f5fefa5bb9a5bbb01f98?d=identicon)[tembra](/maintainers/tembra)

---

Top Contributors

[![tembra](https://avatars.githubusercontent.com/u/6340360?v=4)](https://github.com/tembra "tembra (9 commits)")

---

Tags

jsonapierrorerrorsJSON-API

### Embed Badge

![Health badge](/badges/tembra-jsonapi-errors-php/health.svg)

```
[![Health](https://phpackages.com/badges/tembra-jsonapi-errors-php/health.svg)](https://phpackages.com/packages/tembra-jsonapi-errors-php)
```

###  Alternatives

[neomerx/json-api

Framework agnostic JSON API (jsonapi.org) implementation

7433.7M30](/packages/neomerx-json-api)[cloudcreativity/laravel-json-api

JSON API (jsonapi.org) support for Laravel applications.

7851.1M5](/packages/cloudcreativity-laravel-json-api)[art4/json-api-client

JSON API client

139804.8k8](/packages/art4-json-api-client)[alsvanzelf/jsonapi

Human-friendly library to implement JSON:API without needing to know the specification.

55158.2k6](/packages/alsvanzelf-jsonapi)[cloudcreativity/json-api-testing

PHPUnit test helpers to check JSON API documents.

141.7M4](/packages/cloudcreativity-json-api-testing)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
