icanboogie/errors

Collects and render errors

Maintainers

👁 olvlvl

Package info

github.com/ICanBoogie/Errors

Homepage

pkg:composer/icanboogie/errors

Statistics

Installs: 4 992

Dependents: 4

Suggesters: 0

Stars: 1

Open Issues: 0

v3.0.0 2021-07-23 08:58 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

BSD-3-Clause 302f1b6bb1f09d2dbd82d28adb2f3cb47a2971f9

errors

This package is auto-updated.

Last update: 2026-06-16 08:09:53 UTC


README

👁 Release
👁 Code Quality
👁 Code Coverage
👁 Packagist

Collects formatted errors.

Installation

composer require icanboogie/errors

Usage

<?php

use ICanBoogie\ErrorCollection;

$errors = new ErrorCollection;

var_dump($errors['password']);
// null

$errors->add('password');
var_dump($errors['password']);
// [ Error{ format: '', params: [] } ]

$errors->add('password', 'Invalid password: {value}', [ 'value' => "123" ]);
var_dump($errors['password']);
// 'Invalid password: 123'

$errors['password'] = 'Ugly password';
var_dump($errors['password']);
// array('Invalid password', 'Ugly password')

$errors->add_generic('General error');
count($errors);
// 3

$errors->each(function($name, $message) {

 echo "$name: $message\n";

});
// General error
// password: Invalid password
// password: Ugly password

Continuous Integration

The project is continuously tested by GitHub actions.

👁 Tests
👁 Static Analysis
👁 Code Style

Code of Conduct

This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you are expected to uphold this code.

Contributing

Please see CONTRIBUTING for details.

License

icanboogie/errors is released under the BSD-3-Clause.