Download the PHP package kegi/php-error-handler without Composer

On this page you can find all versions of the php package kegi/php-error-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-error-handler

php-error-handler

PHP7; Object oriented error handler. This is an alpha version.

Introduction

This error handler detects PHP errors, convert them into exceptions and let you handle them easilly. Aditionnaly, this library handle the output buffering to avoid uncompleted body response. This library optionnaly log errors (accepts PSR Interface).

Installation

Install this library with Composer

Debug mode

disabled by default

Strict mode

disabled by default

Strict mode will convert all non-fatal errors into fatal errors.

Complexe error handling runtime

You can execute complexe code if a fatal error is detected. (eg. you can call your errorController, build a response from a template according to the user's language settings...)

If an other fatal error occured while handling this fatal error... (eg. a fatal error on the core of your app), you'll be notified that an unrecoverable error occured and you'll be able to return an error message (eg. return the content of a static error html page).

How to implement it on your project

1) you instanciate PhpErrorHandler at the very beggining of your project.

2) you provided a callable function for the wanted error level (non-fatal, fatal and unrecoverable).

3) the uncaught exception of your project will naturally go on your fatal error method. You don't need to handle them differently anymore.

Example

Command line (CLI)

The errors on command line will also be handled.

Unit testing

coming soon

workflow

alt tag

Output buffering

It's a good practice to build a response object and to emit it when ready, most php router do that. If your project generate content directly (eg. echo, print, var_dump...), this will also be handled.

If a fatal error occured with debug mode disabled, the content already generated will be dismiss so only our error response is visible.

On the error callbacks, you can echo directly your message or return a string.

Parameters

Constructor

If you don't want the library to changed php errors settings (ini_set and error_reporting), set $setErrorDisplay to false on the constructor.

Debug mode

Set/unset debug mode. (default: false)

Strict mode

Set/unset strict mode. With strict mode enabled, non-fatal php error (such as E_NOTICE) are converted into fatal error. (default: false)

Error callback

Set/unset error callback. This will be call for every single php (non-fatal) error. Most project don't need this.

Fatal error callback

Set/unset fatal error callback. This will be call in case of a fatal error. You can print or return your input.

Unrecoverable error callback

Set/unset fatal error callback. This will be call in case of a fatal error from "fatalErrorCallback" or if don't have a fatal error callback defined. You can print or return your input.

Error logger

Set/unset error logger. ErrorLogger need to implement PSR Logger interface. Note: Logs are enabled with or without debug mode.

Cancel

This will cancel the error handler. Once its cancelled, you can't re-enabled it. You'll still be able to read values of the handler (getters). Trying to edit value of the handler (setters) will throw an exception.


All versions of php-error-handler with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
psr/log Version ^1.0
filp/whoops Version ^2.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kegi/php-error-handler contains the following files

Loading the files please wait ....