2017 © Pedro Peláez
 

library slim-whoops

PHP whoops error on slim framework

image

lefuturiste/slim-whoops

PHP whoops error on slim framework

  • Monday, January 1, 2018
  • by lefuturiste
  • Repository
  • 0 Watchers
  • 0 Stars
  • 127 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 10 Forks
  • 0 Open issues
  • 12 Versions
  • 218 % Grown

The README.md

Slim whoops

PHP whoops error on slim framework, (*1)

Status

Build Status, (*2)

Installation

Install the composer, (*3)

curl -sS https://getcomposer.org/installer | php

Edit composer.json, (*4)

Slim Whoops Version Global Mode PHP DI
1 n/a 0.1.* no no
2 1.* 0.3.* no no
3 <= 1.* 0.4.* no no
3 >= 2.* 0.5.* no no
3 >= 2.* 0.6.* yes yes

For Slim framework 3, The composer.json will looks like, (*5)

{
    "require": {
        "zeuxisoo/slim-whoops": "0.6.*"
    }
}

Now, install or update the dependencies, (*6)

php composer.phar install

Usage

Just need to add the middleware in your slim application., (*7)

Simple way, (*8)

In this case, You must ensure this line is first added and on top of other middlewares, (*9)

$app->add(new \Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware);
$app->add(new \Other\MiddlewareA);
$app->add(new \Other\MiddlewareB);

Better DI, (*10)

In this case, You can place this line anywhere no position required, (*11)

$app->add(new \Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware($app));

Global mode, (*12)

In this case, The following code can make Whoops errors in the global scope, whether you have destroyed the program's life cycle, (*13)

$whoopsGuard = new \Zeuxisoo\Whoops\Provider\Slim\WhoopsGuard();
$whoopsGuard->setApp($app);
$whoopsGuard->setRequest($container['request']);
$whoopsGuard->setHandlers([]);
$whoopsGuard->install();

Custom Whoops Handler, (*14)

In this case, You can push custom handler to whoops. For example:, (*15)

A handler like:, (*16)

$simplyErrorHandler = function($exception, $inspector, $run) {
    $message = $exception->getMessage();
    $title   =  $inspector->getExceptionName();

    echo "{$title} -> {$message}";
    exit;
};

Middleware case like:, (*17)

new \Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware($app, [$simplyErrorHandler]);

Global mode case like:, (*18)

$whoopsGuard = new \Zeuxisoo\Whoops\Provider\Slim\WhoopsGuard();
$whoopsGuard->setHandlers([$simplyErrorHandler]);

Options

Opening referenced files with your favorite editor or IDE, (*19)

$app = new App([
    'settings' => [
         // Enable whoops
        'debug'         => true,

        // Support click to open editor
        'whoops.editor' => 'sublime',

        // Display call stack in orignal slim error when debug is off
        'displayErrorDetails' => true,
    ]
]);

Important Note

Version 0.3.0, (*20)

  • The whoops library is installed by default base on the [Whoops Framework Integration Document][1]

Version 0.2.0, (*21)

  • You must to install the whoops library manually.

Testing

Run the test cases, (*22)

php vendor/bin/phpunit

The Versions

01/01 2018

dev-master

9999999-dev https://github.com/zeuxisoo/php-slim-whoops/

PHP whoops error on slim framework

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

exception slim error whoops

01/01 2018

0.6.2

0.6.2.0 https://github.com/zeuxisoo/php-slim-whoops/

PHP whoops error on slim framework

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

exception slim error whoops

23/03 2017

0.6.1

0.6.1.0 https://github.com/zeuxisoo/php-slim-whoops/

PHP whoops error on slim framework

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

exception slim error whoops

18/01 2017

0.6.0

0.6.0.0 https://github.com/zeuxisoo/php-slim-whoops/

PHP whoops error on slim framework

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

exception slim error whoops

09/01 2017

0.5.2

0.5.2.0 https://github.com/zeuxisoo/php-slim-whoops/

PHP whoops error on slim framework

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

exception slim error whoops

19/04 2016

0.5.1

0.5.1.0 https://github.com/zeuxisoo/php-slim-whoops/

PHP whoops error on slim framework

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

exception slim error whoops

31/01 2016

0.5.0

0.5.0.0 https://github.com/zeuxisoo/php-slim-whoops/

PHP whoops error on slim framework

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

exception slim error whoops

08/12 2015

0.4.0

0.4.0.0 https://github.com/zeuxisoo/php-slim-whoops/

PHP whoops error on slim framework

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

exception slim error whoops

08/12 2015

0.4.0.x-dev

0.4.0.9999999-dev https://github.com/zeuxisoo/php-slim-whoops/

PHP whoops error on slim framework

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

exception slim error whoops

06/11 2014

0.3.0

0.3.0.0 https://github.com/zeuxisoo/php-slim-whoops/

PHP whoops error on slim framework

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

exception slim error whoops

02/04 2014

0.2.0

0.2.0.0 https://github.com/zeuxisoo/php-slim-whoops/

PHP whoops error on slim framework

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

exception slim error whoops

14/01 2014

0.1.0

0.1.0.0 https://github.com/zeuxisoo/php-slim-whoops/

PHP whoops error on slim framework

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

exception slim error whoops