PHPackages                             imponeer/object-errors - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. imponeer/object-errors

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

imponeer/object-errors
======================

Library that adds a possibility to collect errors for objects

v3.0.3(1mo ago)051MITPHPPHP &gt;=8.3CI failing

Since Mar 14Pushed 2w ago2 watchersCompare

[ Source](https://github.com/imponeer/object-errors)[ Packagist](https://packagist.org/packages/imponeer/object-errors)[ RSS](/packages/imponeer-object-errors/feed)WikiDiscussions main Synced 4d ago

READMEChangelog (10)Dependencies (6)Versions (19)Used By (0)

[![License](https://camo.githubusercontent.com/7e1553a98303363ca99805c4d3cc23eecef31ec3d04e310619ea5e6008c3f6b7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f696d706f6e6565722f6f626a6563742d6572726f72732e7376673f6d61784167653d32353932303030)](LICENSE)[![Packagist](https://camo.githubusercontent.com/e29b688e9beffcea59a042870123d9d36d553241305bba11b19fa5a463cf9a79/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696d706f6e6565722f6f626a6563742d6572726f72732e737667)](https://packagist.org/packages/imponeer/object-errors) [![PHP](https://camo.githubusercontent.com/175ed063b8f8945d6eba907e8798fd4dd0d26af2e9dbc52b64f93ced71dc5d6f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f696d706f6e6565722f6f626a6563742d6572726f72732e737667)](http://php.net)[![Packagist](https://camo.githubusercontent.com/ce01abaf8dc812fac6b433c4def812c34d54e3e957067cedbc42787b72a69516/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f696d706f6e6565722f6f626a6563742d6572726f72732e737667)](https://packagist.org/packages/imponeer/object-errors)

Object Errors
=============

[](#object-errors)

A PHP library for collecting and managing errors associated with objects. Useful for tracking validation or processing errors in a structured way.

Installation
------------

[](#installation)

Install via [Composer](https://getcomposer.org):

```
composer require imponeer/object-errors
```

Alternatively, you can manually include the files from the `src/` directory.

Usage
-----

[](#usage)

This library allows you to attach an error collection to your objects and manage errors easily.

### Using as a property

[](#using-as-a-property)

Below is a simple usage example by directly creating an `ErrorsCollection` instance:

```
use Imponeer\ObjectErrors\ErrorsCollection;

class MyObject {
    /**
     * @var ErrorsCollection|null
     */
    public $errors = null;

    public function __construct() {
        $this->errors = new ErrorsCollection();
    }

    public function doSomething() {
        // Example logic
        if ($failed) {
            $this->errors->add("Some error");
        }
    }

    public function render() {
        if ($this->errors->isEmpty()) {
            return 'Everything fine';
        } else {
            return $this->errors->getHtml();
        }
    }
}
```

### Using as a trait

[](#using-as-a-trait)

You can also use the provided `ErrorsTrait` to quickly add error handling to your classes:

```
use Imponeer\ObjectErrors\ErrorsTrait;

class MyObject {
    use ErrorsTrait;

    public function doSomething() {
        if ($failed) {
            $this->setErrors("Some error");
        }
    }

    public function render() {
        if ($this->hasError()) {
            return $this->getHtmlErrors();
        }
        return 'Everything fine';
    }
}
```

Development
-----------

[](#development)

Below are useful commands for development. Each command should be run from the project root directory.

Run tests using PHPUnit:

```
composer test
```

Check code style using PHP\_CodeSniffer:

```
composer phpcs
```

Automatically fix code style issues:

```
composer phpcbf
```

Run static analysis using PHPStan:

```
composer phpstan
```

API Documentation
-----------------

[](#api-documentation)

For detailed API documentation, please visit the [Object Errors Wiki](https://github.com/imponeer/object-errors/wiki).

How to contribute?
------------------

[](#how-to-contribute)

Contributions are welcome! If you want to add new features or fix bugs, please fork the repository, make your changes, and submit a pull request.

If you find any bugs or have questions, please use the [issues tab](https://github.com/imponeer/object-errors/issues) to report them or ask questions.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance94

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 51.5% 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.

###  Release Activity

Cadence

Every ~183 days

Recently: every ~152 days

Total

17

Last Release

45d ago

Major Versions

v1.0.4 → v2.0.02023-02-01

v2.0.7 → v3.0.02025-07-08

PHP version history (2 changes)1.0.0PHP &gt;=5.6

v3.0.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/dba53e399a507d1f60626164c8b1e340a5cc0dc4f0637f4c6aaff8fc239fdaee?d=identicon)[fiammybe](/maintainers/fiammybe)

![](https://www.gravatar.com/avatar/7255f306e0ca27292c50cdd9644c1c04e0d7b0f54bf35e0cdd79dc55c83b4923?d=identicon)[MekDrop](/maintainers/MekDrop)

---

Top Contributors

[![MekDrop](https://avatars.githubusercontent.com/u/342641?v=4)](https://github.com/MekDrop "MekDrop (86 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (41 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (30 commits)")[![fiammybe](https://avatars.githubusercontent.com/u/3736946?v=4)](https://github.com/fiammybe "fiammybe (4 commits)")[![Codex](https://avatars.githubusercontent.com/in/2248422?v=4)](https://github.com/Codex "Codex (2 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (2 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")

---

Tags

errorshacktoberfestobjectphp-libraryerrorsobjectcollection

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/imponeer-object-errors/health.svg)

```
[![Health](https://phpackages.com/badges/imponeer-object-errors/health.svg)](https://phpackages.com/packages/imponeer-object-errors)
```

###  Alternatives

[myclabs/deep-copy

Create deep copies (clones) of your objects

8.9k849.8M169](/packages/myclabs-deep-copy)[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k295.3M2.5k](/packages/symfony-property-access)[phpcollection/phpcollection

General-Purpose Collection Library for PHP

1.0k64.0M34](/packages/phpcollection-phpcollection)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k9.2M108](/packages/cuyz-valinor)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[lorisleiva/lody

Load files and classes as lazy collections in Laravel.

956.6M9](/packages/lorisleiva-lody)

PHPackages © 2026

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