GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dotkernel/dot-errorhandler: Logging Error Handler for Dotkernel

BranchesTags
Open more actions menu

Latest commit

 

History

119 Commits
119 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
config
config
 
 
docs/book
docs/book
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.laminas-ci.json
.laminas-ci.json
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
OSSMETADATA
OSSMETADATA
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
composer.json
composer.json
 
 
mkdocs.yml
mkdocs.yml
 
 
phpcs.xml
phpcs.xml
 
 
phpstan.neon
phpstan.neon
 
 
phpunit.xml
phpunit.xml
 
 
structarmed.php
structarmed.php
 
 

Repository files navigation

dot-errorhandler

dot-errorhandler is Dotkernel's PSR-15 compliant error handler.

Version History

Branch Release PSR-11 Log Style Implementation OSS Lifecycle PHP Version
5.0 >= 5.0 2 PSR-Log OSS Lifecycle PHP from Packagist (specify version)
4.1 >= 4.2 2 PSR-Log OSS Lifecycle PHP from Packagist (specify version)
4.1 < 4.2 2 Laminas Log OSS Lifecycle PHP from Packagist (specify version)
4.0 < 4.1 1 Laminas Log OSS Lifecycle PHP from Packagist (specify version)
3.0 < 4.0 1 Laminas Log OSS Lifecycle PHP from Packagist (specify version)

Documentation

Documentation is available at: https://docs.dotkernel.org/dot-errorhandler/

Badges

OSS Lifecycle PHP from Packagist (specify version)

GitHub issues GitHub forks GitHub stars GitHub license

Build Static codecov PHPStan

Adding the error handler

  • Add the composer package:
composer require dotkernel/dot-errorhandler
  • Add the config provider:
    • in config/config.php add \Dot\ErrorHandler\ConfigProvider
    • in config/pipeline.php add \Dot\ErrorHandler\ErrorHandlerInterface::class
      • the interface is used as an alias to keep all error handling related configurations in one file

If you need other error handlers, you should place them before dot-errorhandler in the pipeline; else it will not be able to catch errors. We recommend using just one error handler unless you have an error-specific handler.

  • Configure the error handler as shown below.

In config/autoload/error-handling.global.php:

<?php

use Dot\ErrorHandler\ErrorHandlerInterface;
use Dot\ErrorHandler\LogErrorHandler;

return [
    'dependencies' => [
        'aliases' => [
            ErrorHandlerInterface::class => LogErrorHandler::class,
        ],
    ],
    'dot-errorhandler' => [
        'loggerEnabled' => true,
        'logger' => 'dot-log.default_logger',
    ]
];

A configuration example for the default logger can be found in config/log.global.php.dist.

When configuring the error handler in your application, you can choose between two classes:

  • Dot\ErrorHandler\LogErrorHandler: for logging and displaying errors
  • Dot\ErrorHandler\ErrorHandler: for displaying errors only

Both LogErrorHandler and ErrorHandler have factories declared in the package's ConfigProvider. If you need a custom ErrorHandler, it must have a factory declared in the config, as in the below example:

Example:

<?php

declare(strict_types=1);

return [
    'dependencies'     => [
        'factories' => [
            \App\CustomErrorHandler::class => \App\CustomHandlerFactory::class,
        ],
        'aliases' => [
            \Dot\ErrorHandler\ErrorHandlerInterface::class => \App\CustomErrorHandler::class,
        ],
    ],
    'dot-errorhandler' => [
        'loggerEnabled' => true,
        'logger'        => 'dot-log.default_logger',
    ],
];

Config examples can be found in this project's config directory.

About

Logging Error Handler for Dotkernel

docs.dotkernel.org/dot-errorhandler/

Topics

dotkernelerror-handler

Resources

Readme
MIT license

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

6 stars

Watchers

4 watching

Forks

3 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.