ap-lib/error-node
Composer 安装命令:
composer require ap-lib/error-node
包简介
A simple and lightweight PHP library for handling structured error messages, useful for validation, data processing, and API responses
README 文档
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(); }
统计信息
- 总下载量: 43
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-03