PHPackages                             tounaf/exception-handler - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. tounaf/exception-handler

ActivePackage[Logging &amp; Monitoring](/categories/logging)

tounaf/exception-handler
========================

Exception handler for symfony project

v1.4.0(1y ago)0552[1 PRs](https://github.com/kamakely/exception-handler/pulls)1MITPHP

Since Mar 18Pushed 1y agoCompare

[ Source](https://github.com/kamakely/exception-handler)[ Packagist](https://packagist.org/packages/tounaf/exception-handler)[ RSS](/packages/tounaf-exception-handler/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (7)Used By (1)

Create handler class for each exception that you throw in your application.

1 - Installation
----------------

[](#1---installation)

```
composer require tounaf/exception-handler
```

### 2 - Features

[](#2---features)

this package allows to separate the handler class by exception to avoid code coupling : - One classe handler is responsible for exception - Render response throught different output (html, json, xml) - Decorate classe handler for other needs (Write to log file, send exception to mail, to sentry)

3 - Create Exception Handler class
----------------------------------

[](#3---create-exception-handler-class)

Create an class and implement the ExceptionHandlerInteface interface. It contains two methods:

#### \*\* handleException: This method have Throwble as argument and returns a Symfony Response

[](#-handleexception-this-method-have-throwble-as-argument-and-returns-a-symfony-response)

#### \*\* supportsException: This method have Throwble as argument and return boolean.

[](#-supportsexception-this-method-have-throwble-as-argument-and-return-boolean)

Example:

First create Exception to handle through the app.

```
