PHP Error

PHP Error, error reporting done right!

Better error messages, full syntax highlighting, code snippets,
and works for ajax too

<?php
    // place at start of site
    require( 'php_error.php' );
    \php_error\reportErrors();

Examples

Here you can find more example setups, to make getting started as easy as possible.

API

Documentation for the API can be found here, and you can find information on the php.ini settings available here.

Customization

Options can be given when reporting errors, allowing error reporting to be customized, and to help give better context in regards to your application.

An Example Stack Trace

This is an example of the actual HTML displayed when an error is reported

phperror.localhost | /example/www

AJAX PAUSED phperror.localhost/ X RETRY

View not found: home/indexx

6 app/controller/home.php

<?
    class Home extends SiteController
    {
        public function index() {
            $this->frame->postHTML('css', css( '/css/stack_trace.css' ) );
            $this->view->home->indexx();
            $this->frame->html('js', js( '/js/jquery.1.7.2.js' ) . js( '/js/stack_trace.js' ) );
        }
    }
 
        }
    } else {
        if ( is_array($file) ) {
            $file = join( $file, '/' );
        }
        $filePath = $this->getFlexi()->findFrom( 'view', $file );
        if ( $filePath === false ) {
            throw new Exception( 'View not found: ' . $file );
        } else {
            require( $filePath );
        }
     * @param useFrame states if the frame for this controller should be run or not, before loading the view, and defaults to true.
     */
    public function __view( $file, &$params, $useFrame=true )
    {
        if ( !$this->isInsideView && $useFrame && $this->frame != null ) {
            $this->frame->_loseDefault();
            $this->frame->_runTo();
        }
        $this->__viewInner( $file, $params );
    }
    
        $params = func_num_args() > 1 ?
                array_slice( func_get_args(), 1 ) :
                null ;
        return $this->__view( $file, $params );
    }
    function __view( $file, &$params )
    {
        $this->parentController->__view( $file, $params );
        return $this;
    }
        } else {
            $this->viewParts = array( $parts, $prop );
        }
        return $this;
    }
    function __call( $view, $params )
    {
        return $this->__view( $this->buildViewPath($view), $params );
    }
    function __invoke( $params ) {
    $num = $method->getNumberOfRequiredParameters();
    while ( count($params) < $num ) {
        $params[]= null;
    }
    $this->setPageID( strtolower($class), strtolower($methodName) );
    $this->events->runPreAction( $controller, $params, $class, $methodName );
    $result = $method->invokeArgs( $controller, $params );
    $this->events->runPostAction( $controller, $result, $class, $methodName );
    return true;
    }
    if (
            ! $this->tryControllerMethod(
                    $controller,
                    $name,
                    $action,
                    $params,
                    $methodObj
            )
    ) {
        Flexi::popFlexi();
        throw new Exception(
        $controllerPath = $this->findController( $name );
        if ( $controllerPath === false ) {
            if ( $isDefault ) {
                throw new Exception( 'default controller not found: ' . $this->defaultController );
            } else {
                return $this->run404();
            }
        } else {
            return $this->loadAndRunController( $controllerPath, $name, $action, $params, true );
        }
    }
 
                    }
                }
            }
            // check name is not for this script
            if ( ($this->rootURI.$name) == $_SERVER['PHP_SELF'] ) {
                $name = null;
            }
            $this->runInner( $name, $function, $params );
        }
    }
 
// stop scripts from auto-exiting
define( 'ACCESS_OK', true );
require( 'flexi/flexi.php' );
$flexi = new Flexi();
$flexi->loadConfig( 'config.php' );
$flexi->loadConfig( 'config_local.php', true );
$flexi->loadConfig( 'frames.php' );
// run the website!
$flexi->run( $_SERVER['REQUEST_URI'] );
$flexi->events()->runOnEnd();
 
121flexi/core/corecontroller.phpthrow new Exception( 'View not found: ' . $file );
84flexi/core/corecontroller.phpCoreController->__viewInner( ["home", "indexx"], [] )
236flexi/core/loader.php CoreController->__view( ["home", "indexx"], [] )
371flexi/core/loader.php FlexiViewLoader->__view( ["home", "indexx"], [] )
6app/controller/home.php FlexiViewLoader->__call( "indexx", [] )
6app/controller/home.php FlexiViewLoader->indexx()
[Internal PHP] Home->index()
1230flexi/flexi.php ReflectionMethod->invokeArgs( $Home, [] )
1174flexi/flexi.php Flexi->tryControllerMethod( $Home, "home", "index", [], $ReflectionMethod )
1096flexi/flexi.php Flexi->loadAndRunController( "/example/www", "home", "index", [], true )
993flexi/flexi.php Flexi->runInner( NULL, NULL, [] )
12index.php Flexi->run( "/" )
General project information provided in one place
Code provided from each layer in the stack
Fully syntax highlighted stack trace
Files highlighted according to context