• Stars
    star
    131
  • Rank 274,861 (Top 6 %)
  • Language
    PHP
  • Created over 11 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PHP whoops error on slim framework

Slim whoops

PHP whoops error on slim framework

Status

Build Status Coverage Status Downloads this Month Latest Stable Version

Installation

Install the composer

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

Edit composer.json

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
4 >= 2.* 0.7.* no no

For Slim framework 4, The composer.json will looks like

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

Now, install or update the dependencies

php composer.phar install

Basic Usage

Add to middleware with default settings

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

Or you can pass more settings to the WhoopsMiddleware

$app->add(new Zeuxisoo\Whoops\Slim\WhoopsMiddleware([
    'enable' => true,
    'editor' => 'sublime',
    'title'  => 'Custom whoops page title',
]));

Custom Editor String

If your editor do not included in default editor list, you can custom it like

$app->add(new Zeuxisoo\Whoops\Slim\WhoopsMiddleware([
    'editor' => function($file, $line) {
        return "http://localhost:8091?message=%file:%line";
    }
]));

Custom Handler Usage

In this usage, you can make your own handler for whoops, like:

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

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

And then pass it to the WhoopsMiddleware:

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

Important Note

Version 0.3.0 or above version

Version 0.2.0

  • You must to install the whoops library manually.

More Repositories

1

android-emoji-keyboard

android - test project on custom keyboard style
40
star
2

php-slimork

A small skeleton application to quick start projects using slim framework with other packages
PHP
23
star
3

php-slim-eloquent

PHP laravel eloquent on slim framework
PHP
5
star
4

web-goonui

A GUI for execute ssh commands
Go
3
star
5

php-gluebin

Allows users to upload snippets of text.
PHP
3
star
6

python-pluginplot

Yet another simple plugin system for Python like WordPress plugin system
Python
3
star
7

my-rime

My RIME files
Shell
3
star
8

php-core-validator

A form validator script for data validation when form submit
PHP
2
star
9

go-delega

Package go-delega is a simple proxy list fetcher and collector
Go
2
star
10

python-motorise

A toy project for automating interaction with websites like mechanize
Python
2
star
11

python-googl

Simple library for google shorten url api written in python
1
star
12

my-progetto

Web application to record my projects
TypeScript
1
star
13

web-node-simple-todo

Implement simple todo via node.js & sqlite3 & express
JavaScript
1
star
14

python-currency-epio

Simple exchange rate convert test on epio powered by jquery mobile
1
star
15

web-neko

A toy project for save ideas, bookmark and some activities
PHP
1
star
16

python-simple-book

Simple guestbook app written in python with django
1
star
17

tools-amichanger

A tools for change the serial number in dump ami file
Go
1
star
18

react-native-five00px

A five00px app client implemented using react native for android
JavaScript
1
star
19

web-vidyeo

Simple yet web application to send mobile camera to website canvas
Vue
1
star
20

android-neko

A web-neko client on android platform
Java
1
star
21

my-dns-pi

A set of service included secure Pi-hole, monitoring, and download services
Makefile
1
star
22

web-kauppaa

A application for user submit profile to apply money
PHP
1
star
23

node-twitter-application-only-auth

A simple test for twitter application only authentication oAuth written in node.js
JavaScript
1
star