{"id":23719744,"url":"https://github.com/tembra/jsonapi-errors-php","last_synced_at":"2026-03-10T05:02:37.563Z","repository":{"id":57066558,"uuid":"62092362","full_name":"tembra/jsonapi-errors-php","owner":"tembra","description":"A PHP implementation of JSON API Errors compliant format.","archived":false,"fork":false,"pushed_at":"2016-06-30T18:35:16.000Z","size":13,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-22T09:08:40.169Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tembra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-27T22:22:15.000Z","updated_at":"2020-02-28T09:50:12.000Z","dependencies_parsed_at":"2022-08-24T14:54:01.638Z","dependency_job_id":null,"html_url":"https://github.com/tembra/jsonapi-errors-php","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tembra%2Fjsonapi-errors-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tembra%2Fjsonapi-errors-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tembra%2Fjsonapi-errors-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tembra%2Fjsonapi-errors-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tembra","download_url":"https://codeload.github.com/tembra/jsonapi-errors-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231918541,"owners_count":18445746,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-30T21:54:11.723Z","updated_at":"2026-03-10T05:02:32.476Z","avatar_url":"https://github.com/tembra.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License](https://img.shields.io/packagist/l/tembra/jsonapi-errors-php.svg?style=flat-square)](LICENSE)\n[![Version](https://img.shields.io/packagist/v/tembra/jsonapi-errors-php.svg?style=flat-square)](https://packagist.org/packages/tembra/jsonapi-errors-php)\n[![Total Installs](https://img.shields.io/packagist/dt/tembra/jsonapi-errors-php.svg?style=flat-square)](https://packagist.org/packages/tembra/jsonapi-errors-php)\n[![StyleCI](https://styleci.io/repos/62092362/shield)](https://styleci.io/repos/62092362)\n\n## Description \n\n\u003ca href=\"http://jsonapi.org/\" target=\"_blank\"\u003e\u003cimg src=\"http://jsonapi.org/images/jsonapi.png\" alt=\"JSON API logo\" title=\"JSON API\" align=\"right\" width=\"415\" height=\"130\" /\u003e\u003c/a\u003e\n\nThis 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/).\n\nIt greatly simplifies the error processing with high code quality.\n\nStill framework agnostic, you can easily integrate it with [Laravel/Lumen](https://laravel.com) and [Dingo API](https://github.com/dingo/api).\n\n## Milestone to v1.0\n\n+ [x] Makes JSON API Errors as simple as calling a function\n+ [x] Standardize the errors\n+ [x] Provide most common error functions for HTTP Status Codes\n+ [x] Throw an exception or return the JSON string\n+ [x] Override JSON API Error Objects members\n+ [ ] Support for Localization\n+ [ ] Generate Documentation for Application Error Codes\n+ [ ] Build PHPUnit tests\n\n## Sample usage\n\nAssuming 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:\n```php\necho MyJsonApiErrors::badRequest([\n  827 =\u003e [\n    'title' =\u003e 'Another Error',\n    'detail' =\u003e 'Detailed error description'\n  ]\n], false);\n```\nwill output **as string**\n```json\n{\n  \"errors\": [\n    {\n      \"status\": \"400\",\n      \"code\": \"827\",\n      \"title\": \"Another Error\",\n      \"detail\": \"Detailed error description\"\n    }\n  ]\n}\n```\n\nThe 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.\n\nThe second parameter `false` is to define whether a `JsonApiException` should be thrown or only the JSON string should be returned.\n\n**For more advanced usage please check out the [Wiki](https://github.com/tembra/jsonapi-errors-php/wiki)**.\n\n## Questions?\n\nDo not hesitate to contact me on tdt@mytdt.com.br or post an [issue](https://github.com/tembra/jsonapi-errors-php/issues).\n\n## License\n\nBSD 3-Clause. Please see [License File](LICENSE) for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftembra%2Fjsonapi-errors-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftembra%2Fjsonapi-errors-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftembra%2Fjsonapi-errors-php/lists"}