PHPackages                             antarctica/laravel-base-exceptions - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. antarctica/laravel-base-exceptions

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

antarctica/laravel-base-exceptions
==================================

A set of base exceptions for Laravel applications

v0.2.1(11y ago)01.3k3MITPHPPHP &gt;=5.4.0

Since Dec 12Pushed 11y ago2 watchersCompare

[ Source](https://github.com/antarctica/laravel-base-exceptions)[ Packagist](https://packagist.org/packages/antarctica/laravel-base-exceptions)[ RSS](/packages/antarctica-laravel-base-exceptions/feed)WikiDiscussions master Synced 1mo ago

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

Laravel Base Exceptions
=======================

[](#laravel-base-exceptions)

A set of base [PHP exceptions](http://php.net/manual/en/language.exceptions.php) for Laravel applications.

Installing
----------

[](#installing)

Require this package in your `composer.json` file:

```
{
	"require": {
		"antarctica/laravel-base-exceptions": "0.*"
	}
}
```

Run `composer update`.

Usage
-----

[](#usage)

### `HttpException`

[](#httpexception)

Extends the Symfony [HttpException](http://api.symfony.com/2.3/Symfony/Component/HttpKernel/Exception/HttpException.html).

This exception is designed for use with APIs or other situations where an error occurs during the processing of HTTP requests.

It extends the Symfony [HttpException](http://api.symfony.com/2.3/Symfony/Component/HttpKernel/Exception/HttpException.html) to ensure easy integration/compatibility with the [JSON Exception Formatter](https://github.com/Radweb/JSON-Exception-Formatter) package for Laravel.

This exception also adds a number of custom properties used to make using exceptions as errors easier.

#### Properties

[](#properties)

Note: the standard `message` property is also supported by this exception but not documented here.

##### `statusCode` (int)

[](#statuscode-int)

Sets the HTTP status code to be used in the response, as [defined in the parent exception](http://api.symfony.com/2.3/Symfony/Component/HttpKernel/Exception/HttpException.html#method_getStatusCode).

##### `headers` (int)

[](#headers-int)

Array of headers to be returned in the response, as [defined in the parent exception](http://api.symfony.com/2.3/Symfony/Component/HttpKernel/Exception/HttpException.html#method_getHeaders)

##### `kind` (string)

[](#kind-string)

Human/machine readable error 'type', usually similar to the exception class as this isn't included in errors in a production environment.

##### `details` (array)

[](#details-array)

Free form, but structured 'catch all' for error content. This may be designed for machine or human reading as needed.

For example if you need to include some data that another service should consume or for describing specific validation errors (which wouldn't be suitable to cover in the *kind* or *message* properties).

##### `resolution` (string)

[](#resolution-string)

Human readable, terse description of how to fix the error, if detailed information is needed to achieve this host this externally and include its location in the *resolutionURLs* property.

##### `resolutionURLs` (array)

[](#resolutionurls-array)

Human/machine readable list of URLs/URIs relevant to how to fix the error. These may be consumed automatically by a service (i.e. point to another API resource or service) or links to relevant documentation etc. describing how to fix the error in more detail.

#### Basic usage (Laravel)

[](#basic-usage-laravel)

```
