PHPackages                             tbbc/rest-util-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. [HTTP &amp; Networking](/categories/http)
4. /
5. tbbc/rest-util-bundle

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

tbbc/rest-util-bundle
=====================

Bundle for integrating tbbc/rest-util lib in a Symfony application.

v1.0.3(5y ago)30205.4k↓29.5%61MITPHPCI failing

Since Nov 25Pushed 3y ago6 watchersCompare

[ Source](https://github.com/TheBigBrainsCompany/TbbcRestUtilBundle)[ Packagist](https://packagist.org/packages/tbbc/rest-util-bundle)[ RSS](/packages/tbbc-rest-util-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (5)Used By (1)

The Big Brains Company - TbbcRestUtilBundle
===========================================

[](#the-big-brains-company---tbbcrestutilbundle)

[![Build Status](https://camo.githubusercontent.com/c73a74b2be972d0c4aff6cc5675dba0ca26a003e4b7171a13b91a1f020fb2c1a/68747470733a2f2f7472617669732d63692e6f72672f546865426967427261696e73436f6d70616e792f54626263526573745574696c42756e646c652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/TheBigBrainsCompany/TbbcRestUtilBundle)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/8fe42b2375b242e301ecd3f2736281ba1704366fb39b86f2ae6f7845126cbf38/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f546865426967427261696e73436f6d70616e792f54626263526573745574696c42756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f733d38303261653666306631396535613930623966636436653561653531323934336565623430393132)](https://scrutinizer-ci.com/g/TheBigBrainsCompany/TbbcRestUtilBundle/)

A bundle for integrating [tbbc/rest-util](https://github.com/TheBigBrainsCompany/rest-util) lib in a Symfony application

Table of contents
-----------------

[](#table-of-contents)

1. [Installation](#installation)
2. [Quick start](#quick-start)
3. [Usage](#usage)
4. [Run the test](#run-the-test)
5. [Contributing](#contributing)
6. [Requirements](#requirements)
7. [Authors](#authors)
8. [License](#license)

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

[](#installation)

Using [Composer](http://getcomposer.org/), just `$ composer require tbbc/rest-util-bundle` package or:

```
{
  "require": {
    "tbbc/rest-util-bundle": "@stable"
  }
}
```

Quick start
-----------

[](#quick-start)

### Handling errors in a REST(ful) API

[](#handling-errors-in-a-restful-api)

\#### Configuration

```
tbbc_rest_util:
    error:
        use_bundled_factories: true
        exception_mapping:
            FormErrorException:
                class: "Tbbc\\RestUtilBundle\\Error\\Exception\\FormErrorException"
                factory: tbbc_rest_util_form_error
                http_status_code: 400
                error_code: 400101
                error_message: "Invalid input"
                error_more_info_url: "http://api.my.tld/doc/error/400101"
            AccessDeniedException:
                class: "Symfony\\Component\\Security\\Core\\AccessDeniedException"
                factory: default
                http_status_code: 401
                error_code: 401001
                error_message: "Access denied"
                extended_message: "The given token don't have enough privileges for accessing to this resource"
                error_more_info_url: "http://api.my.tld/doc/error/401001"
            CustomException:
                class: "My\\ApiBundle\\Exception\\CustomException"
                factory: my_api_custom
                http_status_code: 501
                error_code: 501001
                error_more_info_url: "http://api.my.tld/doc/error/501001"
            Exception:
                class: "\\Exception"
                factory: default
                http_status_code: 500
                error_code: 501203
                error_message: "Server error"
```

#### Custom Symfony Exception Listener

[](#custom-symfony-exception-listener)

```
