PHPackages                             slm/exception - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. slm/exception

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

slm/exception
=============

Extensive exception handling for Zend Framework 2

v0.1.0(12y ago)83162[4 issues](https://github.com/juriansluiman/SlmException/issues)BSD-3-ClausePHPPHP &gt;=5.3.3.

Since Oct 3Pushed 11y ago2 watchersCompare

[ Source](https://github.com/juriansluiman/SlmException)[ Packagist](https://packagist.org/packages/slm/exception)[ Docs](https://github.com/juriansluiman/SlmException)[ RSS](/packages/slm-exception/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

SlmException
============

[](#slmexception)

SlmException is a Zend Framework 2 module to gain more control over the exception handling in your application. It provides various markers for exception classes so you have fine grained control about the rendered view script and HTTP status code of a thrown exception.

Furthermore are two features planned: out of the box logging of exceptions to your defined logger instance and custom messages displayed per exception.

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

[](#installation)

SlmException can be installed via composer. Put the `slm/exception` dependency in your list and run `composer update`. At this moment there is no tag of SlmException so you have to rely on `dev-master` to use this module. Furthermore, enable `SlmException` in your application.module.config.

Usage
-----

[](#usage)

SlmException now focuses on a single feature: fine grained control of exception view template rendering and HTTP status code output. A real-world use case is your Blog module where you want to fetch an Article entity. However, when no article can be found, you possibly throw a `Blog\Exception\ArticleNotFound` exception. On the other hand, you want to display a "Page not found" message to the visitor trying to access this non-existing blog article.

What you need to do is to implement a marker interface from SlmException, the rest is done automatically:

```
