Download the PHP package jasny/error-handler without Composer

On this page you can find all versions of the php package jasny/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 error-handler

Jasny Error Handler

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight Packagist Stable Version Packagist License

Error handler with PSR-7 support.

Installation

The Jasny Error Handler package is available on packagist. Install it using composer:

composer require jasny/error-handler

Usage

Just creating an error handler will do nothing. You can use it for logging, handling fatal errors and as PSR-7 compatible middleware.

Logging

By default the error handler with only catch Throwables and not set the php error handler.

To log errors, set the logger using setLogger(). You can log with any PSR-3 compatible logger like Monolog.

The logUncaught() method will set the error handler, so warnings and notices can be logged. It may also register a shutdown function to handle uncatchable fatal errors.

PSR-7 compatible middleware

The error handler can be used as PSR-7 compatible (double-pass) middleware.

The error will catch Exceptions and Errors.

You can use this middleware with:

For example use it with Relay:

Or with Jasny Router:

PHP 5 support

With PHP 5 errors aren't thrown, so the middleware won't handle it. To add middleware support for errors in PHP5, you should call converErrorsToExceptions(). This method will convert an error to an ErrorException.

Handling fatal errors

Errors that are not thrown, like syntax errors, are not caught and will cause a fatal error. With the logUncaught() method, you can specify that the error handler should also these kind of errors.

With the onFatalError() method you take additional action, like output a pretty error message.

Use true as second argument of onFatalError to the output buffer before calling your function.

Combine with other error handlers

Using the error logger might lose backtrace information that other error handlers can pick up. Jasny Error Handler will always call the previous error handler, including the PHP internal error handler for non-thrown errors.

When using Rollbar you should not use the Rollbar handler for Monolog. By using Rollbar's own error handler, you'll get better error reports:


All versions of error-handler with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
psr/http-message Version ^1.0
psr/log Version ^1.0
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 jasny/error-handler contains the following files

Loading the files please wait ....