The ErrorHandler component provides tools to manage errors and ease debugging PHP code

Overview

ErrorHandler Component

The ErrorHandler component provides tools to manage errors and ease debugging PHP code.

Getting Started

$ composer require symfony/error-handler
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\ErrorHandler\ErrorHandler;
use Symfony\Component\ErrorHandler\DebugClassLoader;

Debug::enable();

// or enable only one feature
//ErrorHandler::register();
//DebugClassLoader::enable();

// If you want a custom generic template when debug is not enabled
// HtmlErrorRenderer::setTemplate('/path/to/custom/error.html.php');

$data = ErrorHandler::call(static function () use ($filename, $datetimeFormat) {
    // if any code executed inside this anonymous function fails, a PHP exception
    // will be thrown, even if the code uses the '@' PHP silence operator
    $data = json_decode(file_get_contents($filename), true);
    $data['read_at'] = date($datetimeFormat);
    file_put_contents($filename, json_encode($data));

    return $data;
});

Resources

You might also like...
A collection of command-line utilities to aid in debugging browser engines.

Browser debug utilities This project contains several scripts that make the process of debugging browser engines much easier (some special cases excep

This component provides functions unavailable in releases prior to PHP 8.0.

This component provides functions unavailable in releases prior to PHP 8.0.

The VarExporter component allows exporting any serializable PHP data structure to plain PHP code.

The VarExporter component allows exporting any serializable PHP data structure to plain PHP code. While doing so, it preserves all the semantics associated with the serialization mechanism of PHP (__wakeup, __sleep, Serializable).

Nuber is an open source container management platform it provides a front end to manage your own cloud infrastructure, using Linux Containers virtualization technology

Nuber is an open source container management platform it provides a front end to manage your own cloud infrastructure, using Linux Containers virtualization technology

This component provides a collection of functions/classes using the symfony/intl package when the Intl extension is not installed.

Symfony Polyfill / Intl: ICU This package provides fallback implementations when the Intl extension is not installed. It is limited to the "en" locale

The Cache component provides an extended PSR-6 implementation for adding cache to your applications.

Symfony PSR-6 implementation for caching The Cache component provides an extended PSR-6 implementation for adding cache to your applications. It is de

Very easy to use a current limiting component, the code is very simple, based on the webman framework.

Very easy to use a current limiting component, the code is very simple, based on the webman framework.

This package provides a simple and intuitive way to work on the Youtube Data API. It provides fluent interface to Youtube features.

Laravel Youtube Client This package provides a simple and intuitive way to work on the Youtube Data API. It provides fluent interface to Youtube featu

Comments
  • Better fix for xdebug >= 3.0 when trying to produce a trace during FatalError situations

    Better fix for xdebug >= 3.0 when trying to produce a trace during FatalError situations

    EDIT: sorry, moving to symfony/symfony

    When the application is already dealing with a FatalError, we should avoid calling xdebug in situations we know will produce another php_error from within xdebug itself.

    xdebug_get_function_stack() can be called in xdebug < 3.0 (ie: ini_get('xdebug.mode') will return false since it doesn't not exist

    OR

    xdebug_get_function_stack() can be called in xdebug >= 3.0 when ini_get('xdebug.mode') returns develop.

    @derickr thoughts?

    opened by ralphschindler 1
Releases(v6.2.3)
  • v6.2.3(Dec 28, 2022)

  • v6.1.9(Dec 28, 2022)

    Changelog (https://github.com/symfony/error-handler/compare/v6.1.8...v6.1.9)

    • bug #48624 Fix reading the SYMFONY_IDE env var (nicolas-grekas)
    • bug #48618 Fix some new return types support (fancyweb)
    • bug #48615 Fix getting the name of closures on PHP 8.1.11+ (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.17(Dec 28, 2022)

    Changelog (https://github.com/symfony/error-handler/compare/v6.0.16...v6.0.17)

    • bug #48618 Fix some new return types support (fancyweb)
    • bug #48615 Fix getting the name of closures on PHP 8.1.11+ (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.17(Dec 28, 2022)

    Changelog (https://github.com/symfony/error-handler/compare/v5.4.16...v5.4.17)

    • bug #48618 Fix some new return types support (fancyweb)
    • bug #48615 Fix getting the name of closures on PHP 8.1.11+ (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.2.2(Dec 16, 2022)

    Changelog (https://github.com/symfony/error-handler/compare/v6.2.1...v6.2.2)

    • bug #48624 Fix reading the SYMFONY_IDE env var (nicolas-grekas)
    • bug #48618 Fix some new return types support (fancyweb)
    • bug #48615 Fix getting the name of closures on PHP 8.1.11+ (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.2.1(Dec 6, 2022)

  • v6.2.0(Nov 30, 2022)

  • v6.2.0-RC1(Nov 25, 2022)

  • v6.2.0-BETA3(Nov 19, 2022)

  • v6.2.0-BETA2(Oct 28, 2022)

  • v6.1.7(Oct 28, 2022)

  • v6.0.15(Oct 28, 2022)

  • v5.4.15(Oct 28, 2022)

  • v6.2.0-BETA1(Oct 24, 2022)

    Changelog (https://github.com/symfony/error-handler/compare/v6.1.6...v6.2.0-BETA1)

    • feature #47730 Ban DateTime from the codebase (WebMamba)
    • feature #47236 Generate lazy-loading virtual proxies for non-ghostable lazy services (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.1.6(Oct 12, 2022)

  • v6.0.14(Oct 12, 2022)

  • v5.4.14(Oct 12, 2022)

  • v6.1.3(Jul 29, 2022)

    Changelog (https://github.com/symfony/error-handler/compare/v6.1.2...v6.1.3)

    • bug #47086 Workaround disabled "var_dump" (nicolas-grekas)
    • bug #47000 Fix return type patching for list and class-string pseudo types (derrabus)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.11(Jul 29, 2022)

    Changelog (https://github.com/symfony/error-handler/compare/v6.0.10...v6.0.11)

    • bug #47086 Workaround disabled "var_dump" (nicolas-grekas)
    • bug #47000 Fix return type patching for list and class-string pseudo types (derrabus)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.11(Jul 29, 2022)

    Changelog (https://github.com/symfony/error-handler/compare/v5.4.10...v5.4.11)

    • bug #47086 Workaround disabled "var_dump" (nicolas-grekas)
    • bug #47000 Fix return type patching for list and class-string pseudo types (derrabus)
    Source code(tar.gz)
    Source code(zip)
  • v4.4.44(Jul 29, 2022)

    Changelog (https://github.com/symfony/error-handler/compare/v4.4.43...v4.4.44)

    • bug #47086 Workaround disabled "var_dump" (nicolas-grekas)
    • bug #47000 Fix return type patching for list and class-string pseudo types (derrabus)
    Source code(tar.gz)
    Source code(zip)
  • v6.1.0(May 27, 2022)

  • v6.0.9(May 27, 2022)

    Changelog (https://github.com/symfony/error-handler/compare/v6.0.8...v6.0.9)

    • bug #46302 Fix list of tentative return types (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.9(May 27, 2022)

    Changelog (https://github.com/symfony/error-handler/compare/v5.4.8...v5.4.9)

    • bug #46302 Fix list of tentative return types (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.1.0-RC1(May 14, 2022)

    Changelog (https://github.com/symfony/error-handler/compare/v6.1.0-BETA2...v6.1.0-RC1)

    • bug #46302 Fix list of tentative return types (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.8(Apr 27, 2022)

  • v5.4.8(Apr 27, 2022)

  • v4.4.41(Apr 27, 2022)

  • v6.1.0-BETA1(Apr 15, 2022)

    Changelog (https://github.com/symfony/error-handler/compare/v6.0.7...v6.1.0-BETA1)

    • feature #45745 Read SYMFONY_IDE to render exception in case of fatal error (GromNaN)
    • feature #45377 Bump minimum version of PHP to 8.1 (nicolas-grekas)
    • feature #45360 trigger deprecations for @final properties (nicolas-grekas, fancyweb)
    • feature #45303 Report overridden @final constants (fancyweb)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.7(Apr 2, 2022)

Task for GrumPHP that adds CSS linting support with stylelint. An easy way to enforce convention and avoid errors in your styles

grumphp-stylelint-task Installation Stylelint is a static analysis tool for styles. A mighty, modern linter that helps you avoid errors and enforce co

null 3 Apr 29, 2021
PHP errors for cool kids

whoops PHP errors for cool kids whoops is an error handler framework for PHP. Out-of-the-box, it provides a pretty error interface that helps you debu

Filipe Dobreira 12.9k Jan 3, 2023
A simple PHP package for sending messages to Slack, with a focus on ease of use and elegant syntax.

Slack for PHP A simple PHP package for sending messages to Slack with incoming webhooks, focussed on ease-of-use and elegant syntax. Note: this packag

Regan McEntyre 1.2k Oct 29, 2022
UMySQL is an extremely simple PHP library for communicating with MySQL databases with ease while keeping overhead to a bare minimum.

Uncomplicated MySQL UMySQL is an extremely simple PHP library for communicating with MySQL databases with ease while keeping overhead to a bare minimu

José Miguel Moreno 4 Oct 24, 2022
Utility that helps you switch git configurations with ease.

git-profile Utility that helps you switch git configurations with ease Preface It is possible that you have multiple git configurations. For example:

Zeeshan Ahmad 240 Jul 18, 2022
A complete solution for group projects in organizations that lets you track your work in any scenario. Working in a team is a cumbersome task, ease it using our project management system.

SE-Project-Group24 What is Evolo? Evolo is Dashboard based Project Management System. A complete solution for group projects in organizations that let

Devanshi Savla 2 Oct 7, 2022
Magento 2 Debug Helper Module for easy debugging with Xdebug and PHPStorm or any other IDE

Magento 2 Debug Helper Information and Usage Magento 2 Debug Helper Module usage with PHPStorm and Xdebug Installation To install the Magento 2 Debug

Dmitry Shkoliar 13 May 24, 2022
Run PHP scripts on the fly at runtime on a PocketMine-MP server (useful for debugging)

Scripter Run PHP scripts on the fly at runtime on a PocketMine-MP server. This is useful for runtime debugging, when you don't want to restart the ser

Dylan's PocketMine-MP Plugins 15 Jul 28, 2022
Docker image that provides static analysis tools for PHP

Static Analysis Tools for PHP Docker image providing static analysis tools for PHP. The list of available tools and the installer are actually managed

Jakub Zalas 1.1k Jan 1, 2023