2017 © Pedro Peláez
 

library peel

image

avalanche-development/peel

  • Thursday, December 29, 2016
  • by jacobemerick
  • Repository
  • 1 Watchers
  • 1 Stars
  • 2,413 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 2 % Grown

The README.md

peel

An exception library that can be used to bubble up specific http errors through middleware., (*1)

Build Status Code Climate Test Coverage, (*2)

Installation

It's recommended that you use Composer to install peel., (*3)

$ composer require avalanche-development/peel

peel requires PHP 5.6 or newer., (*4)

Usage

function someMiddleware($request, $response, $next) {
    $body = (string) $request->getBody();
    $body = json_decode($value);
    if (json_last_error() !== JSON_ERROR_NONE) {
        throw new AvalancheDevelopment\Peel\HttpError\BadRequest('Invalid JSON');
    }
    // etc
}

Each exception implements AvalancheDevelopment\Peel\HttpErrorInterface, which enforces two methods, getStatusCode and getStatusMessage. These give you the expected HTTP code and message for any sort of error handler., (*5)

Exceptions

Note: see avalanche-development/crash-pad for an error handler that takes advantage of these standardized exceptions., (*6)

Development

This library is a work in progress - there may be additional options (like, error metadata) added for different statuses as needed., (*7)

Tests

To execute the test suite, you'll need phpunit (and to install package with dev dependencies)., (*8)

$ phpunit

License

peel is licensed under the MIT license. See License File for more information., (*9)

The Versions

29/12 2016

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Avatar jacobemerick

29/12 2016

0.3.0

0.3.0.0

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Avatar jacobemerick

12/11 2016

0.2.1

0.2.1.0

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Avatar jacobemerick

06/11 2016

0.2.0

0.2.0.0

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Avatar jacobemerick

02/11 2016

0.1.1

0.1.1.0

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Avatar jacobemerick

31/10 2016

0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Avatar jacobemerick