ap-lib / error-node
A simple and lightweight PHP library for handling structured error messages, useful for validation, data processing, and API responses
Installs: 43
Dependents: 5
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/ap-lib/error-node
Requires
- php: ^8.3
- ext-mbstring: *
- ap-lib/context: dev-main
Requires (Dev)
- phpunit/phpunit: 10.5.*
This package is auto-updated.
Last update: 2025-09-18 22:45:31 UTC
README
A simple and lightweight PHP library for handling structured error messages, useful for validation, data processing, and API responses.
Installation
composer require ap-lib/error-node
Features
- Structured error representation
- Easy instantiation of single or multiple errors
- Throwable error handling
- Simple and extensible design
Requirements
- PHP 8.3 or higher
Getting started
Basic usage
use AP\ErrorNode\Error; use AP\ErrorNode\Errors; use AP\ErrorNode\ThrowableErrors; // Creating a single error $error = new Error("Invalid input", ["user", "email"]); // Creating multiple errors $errors = new Errors([ new Error("Field is required", ["user", "name"]), new Error("Invalid format", ["user", "email"]), ]); // Handling errors if (!empty($errors->getErrors())) { throw $errors->getNodeErrorsThrowable(); }