dhii/validation-interface
最新稳定版本:v0.3.0-alpha3
Composer 安装命令:
composer require dhii/validation-interface
包简介
A base interface for validators
README 文档
README
Simple interface for most basic validator implementations.
Details
This package aims to standardize validators, so as to make consuming code compatible with a wide variety of validator implementations. Validation is such a common task that being able to validate in an interoperable way is extremely useful. Interfaces in this package aim to fix that by providing a common validation entry point on one side, and standards-compliant validation error exceptions on the other. This allow developers to take advantage of exception "bubbling" and handle validation errors where they think best, as well as to retrieve a list of human-readable validation error messages without knowledge of the validator internals, or prior reference to the validator object. Also, reporting validation failure as an exception is very convenient for cases where it is only possible to continue if a validation subject is valid.
Interfaces
ValidatorInterface- The central interface of the standard. Provides validation entry point (trigger) asvalidate(). Validators MUST implement this interface.ValidationFailedExceptionInterface- Occurs when subject fails validation, and reports the failed subject, and the validator that validated the subject, as well as a list of validation error messages.ValidationExceptionInterface- Represents an error related to a validator.
统计信息
- 总下载量: 136.53k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 9
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-10