Skip to content

Latest commit

 

History

History
97 lines (73 loc) · 3.57 KB

README.md

File metadata and controls

97 lines (73 loc) · 3.57 KB

ErrorHandler

Latest stable version Build Status Coverage Status

Simple error and exception handler:

  • converts error to an ErrorException instance according to error reporting level
  • when running the PHP CLI, reports errors/exceptions to STDERR (even fatal error) and uses exception code as exit status
  • allows to deactivate @ operator
  • catches fatal error
  • accepts callback to be executed at the end of the internal shutdown function
  • accepts callback to display an apology when errors are hidden
  • allows to ignore errors on some paths, useful with old libraries and deprecated code…

Usage

  1. Class autoloading and dependencies are managed by Composer so install it following the instructions on Composer: Installation - *nix or just run the following command:
$ curl -sS https://getcomposer.org/installer | php
  1. Add dependency to GAubry\ErrorHandler into require section of your composer.json:
    {
        "require": {
            "geoffroy-aubry/errorhandler": "1.0.*"
        }
    }

and run php composer.phar install from the terminal into the root folder of your project.

  1. Include Composer's autoloader and use the GAubry\ErrorHandler class:
    <?php
    
    require_once 'vendor/autoload.php';
    use GAubry\ErrorHandler\ErrorHandler;
    
    $aConfig = array(
        'display_errors' => true,
        'error_log_path' => '/var/log/xyz.log',
        'error_level' => -1,
        'auth_error_suppr_op' => false
    );
    new ErrorHandler($aConfig);
    
    …

Documentation

API documentation is generated by ApiGen in the doc/api folder.

$ php vendor/bin/apigen.php -c apigen.neon

Copyrights & licensing

Licensed under the GNU Lesser General Public License v3 (LGPL version 3). See LICENSE file for details.

Change log

See CHANGELOG file for details.

Continuous integration

Build Status Coverage Status

Following commands are executed during each build and must report neither errors nor warnings:

  • Unit tests with PHPUnit:

    $ php vendor/bin/phpunit --configuration phpunit.xml
  • Coding standards with PHP CodeSniffer:

    $ php vendor/bin/phpcs --standard=PSR2 src/ tests/ -v
  • Code quality with PHP Mess Detector:

    $ php vendor/bin/phpmd src/ text codesize,design,unusedcode,naming,controversial

Git branching model

The git branching model used for development is the one described and assisted by twgit tool: https://github.com/Twenga/twgit.