PHPackages                             vvasystem/errorstrait - 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. vvasystem/errorstrait

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

vvasystem/errorstrait
=====================

Simple Errors Trait for PHP classes

1.0.1(10y ago)020MITPHPPHP &gt;=5.4.0

Since Mar 26Pushed 10y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Errors Trait
============

[](#errors-trait)

Simple Errors Trait for PHP classes.

Install
-------

[](#install)

```
composer require vvasystem/errorstrait

```

How to use?
-----------

[](#how-to-use)

You have some class.

```
class Process
{

    /**
     * Use error trait
     */
	use \Assistance\ErrorsTrait\ErrorTrait;

	//...

    /**
     * Run process
     * @return $this
     */
	public function run() {
		// do something

		// is error happened - add error
		$this->addError('This is error');

		return $this;
	}
}
```

and...

```
//...
require __DIR__ . '/vendor/autoload.php';

//...
session_start();
//...

require __DIR__ . '/Process.php';

// current page
$process = new Process();
$process->run();

if ($process->hasErrors()) {
	$errorArr = $process->getErrors();
	echo 'Current errors:' . PHP_EOL;
	foreach ($errorArr as $error) {
		echo $error . PHP_EOL;
	}

	$process->errorsToSession('process_errors');
}

//another page - get from session by key
$errors = new \Assistance\ErrorsTrait\Errors();
$errors->loadFromSession('process_errors');

if ($errors->hasErrors()) {
	$errorArr = $errors->getErrors();
	echo 'Errors for this page:' . PHP_EOL;
	foreach ($errorArr as $error) {
		echo $error . PHP_EOL;
	}
}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3702d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/83a1dea8a3cf3e3453430ad9e43fc02b5fbbc0b8c22f04b82b29980b7e5bcb3a?d=identicon)[vvasystem](/maintainers/vvasystem)

---

Top Contributors

[![vvasystem](https://avatars.githubusercontent.com/u/3647630?v=4)](https://github.com/vvasystem "vvasystem (19 commits)")

---

Tags

errorssimple errorssimple errors class

### Embed Badge

![Health badge](/badges/vvasystem-errorstrait/health.svg)

```
[![Health](https://phpackages.com/badges/vvasystem-errorstrait/health.svg)](https://phpackages.com/packages/vvasystem-errorstrait)
```

###  Alternatives

[kevinlebrun/slug.php

Slug helpers

4451.4k1](/packages/kevinlebrun-slugphp)

PHPackages © 2026

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