PHPackages                             mansartesteban/error-handler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. mansartesteban/error-handler

AbandonedLibrary

mansartesteban/error-handler
============================

Error handler class which log your Exceptions and can make beautiful display of them.

05PHP

Since Mar 11Pushed 7y agoCompare

[ Source](https://github.com/mansartesteban/error-handler)[ Packagist](https://packagist.org/packages/mansartesteban/error-handler)[ RSS](/packages/mansartesteban-error-handler/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Language
========

[](#language)

[Français](readme/README.fr.md)

Presentation
============

[](#presentation)

This libs make you ablde to handle Exceptions. It create log files sorted by date and type. ErrorHandler provide a parsing system for log file to display beautiful interface (Inprogress)

Documentation
=============

[](#documentation)

Methods
-------

[](#methods)

```
ErrorHandler::init($options = []);
ErrorHandler::isCreated();
ErrorHandler::log($type = "", Exception $ex, mixed $additionalParameters = null);
```

Options
-------

[](#options)

```
ErrorHandler::init($options = []);
```

At initialization, you have to pass as parameter an options array to define the behavior of you handler, otherwise it will throw a *LogicException*

```
$options = [
  "logDir" => "/log", // Path to directory which contains log files
  "cssClass" => "errorHandler-log", // CSS class name that delimitate a log section
];
```

**`logDir`** is a `string` you define. If it ends by "/", the "/" will be ignored (*Ex: "/private/log", "/log", "/engine/error/log/", ...*)

**`cssClass`** is `string`you define (*Ex: "log", "error-log", "admin-log-section", ...*)

---

```
ErrorHandler::log($type = "", Exception $ex, $additionalParameters = null)
```

**`type`** is a *`string`* which define the error type. It is used to create sub-diirectory in $options\["*logDir*"\] (*Ex: "PDO", "PHP", "API\_FACEBOOK", ...*)

**`ex`** is an *`Exception`* that you catch or instanciate. You can pass any Exception type herited.

Examples
--------

[](#examples)

### Initialization

[](#initialization)

```
//File : /src/config/initClasses.php

$optionsErrorHandler = [
  "logDir" => "/private/log",
  "cssClass" => "log-error"
];

if (!ErrorHandler::isCreated()) {
  ErrorHandler::init($optionsErrorHandler);
}
```

### Log an Exception

[](#log-an-exception)

```
// Exemple 1 :
try {
  // your code here ...
} catch (PDOException $ex) {
  ErrorHandler::log("PDO", $ex, [$sqlReq, $sqlParams]);
}

// Exemple 2 :
if ($url == null) {
  ErrorHandler::log("logic", new LogicExepction("url for cURL request is null"));
}
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community3

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

---

Top Contributors

[![mansartesteban](https://avatars.githubusercontent.com/u/25709401?v=4)](https://github.com/mansartesteban "mansartesteban (27 commits)")

---

Tags

errorexceptionhandlerphpthrowable

### Embed Badge

![Health badge](/badges/mansartesteban-error-handler/health.svg)

```
[![Health](https://phpackages.com/badges/mansartesteban-error-handler/health.svg)](https://phpackages.com/packages/mansartesteban-error-handler)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
