icanboogie / errors
Collects and render errors
Installs: 4 857
Dependents: 4
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=8.0
- icanboogie/common: ^2.0
Requires (Dev)
- phpstan/phpstan: ^0.12.93
- phpunit/phpunit: ^9.5
README
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.
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.