PHPackages                             ped/api-error-bundle - 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. ped/api-error-bundle

ActiveSymfony-bundle[API Development](/categories/api)

ped/api-error-bundle
====================

A bundle that provides tools for easy and consistent API error handling

00PHPCI failing

Since May 30Pushed 6y ago1 watchersCompare

[ Source](https://github.com/paneedesign/api-error-bundle)[ Packagist](https://packagist.org/packages/ped/api-error-bundle)[ RSS](/packages/ped-api-error-bundle/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

API Error Bundle
================

[](#api-error-bundle)

This bundle provides various tools to handle errors in a consistent way in your RESTful APIs based on Symfony.

Why should I use it?
--------------------

[](#why-should-i-use-it)

Because you are smart and you don't want to reinvent the wheel. This bundle provides you a framework to build your delightful error messages in a structured way. You could accomplish the same result without this bundle but you should write some boilerplate code that this bundle is already includes. Don't waste your time!

Background
----------

[](#background)

A good error response consists of three basic criteria in order to be truly helpful:

1. An HTTP Status Code, so that the source and realm of the problem can be ascertained with ease.
2. An Internal Reference ID for documentation-specific notation of errors.
3. Human readable messages that summarize the context, cause, and general solution for the error at hand.

The [RFC 7807](https://tools.ietf.org/html/rfc7807.html) aims to define a standard way to carry machine- readable details of errors in a HTTP response to avoid the need to define new error response formats for HTTP APIs.

This solution, inspired by the [RFC 7807](https://tools.ietf.org/html/rfc7807.html), is fully customizable and extensible. I could say you can use this bundle in every API project to render your error messages in the format you like.

Installation
------------

[](#installation)

Add the following dependency in the require section of your composer.json:

```
"ped/api-error-bundle": "dev-master"

```

Add the repository as well in the repositories section of the composer.json:

```
"repositories": [
	{
  		"type": "vcs",
		"url": "git@bitbucket.org:paneedesign/api-error-bundle.git"
	}
],

```

Enable the bundle by adding the following line in the `bundles.php`:

```
