ksfraser/validation
最新稳定版本:v0.1.0
Composer 安装命令:
composer require ksfraser/validation
包简介
Small validation helpers and traits (PHP 7.3+) for KS Fraser modules migration.
README 文档
README
PHP 7.3+ validation helpers and traits intended to replace legacy Origin-style ad-hoc validation during the library split.
Design goals
- No framework dependencies.
- Usable from DTOs, repositories, service classes.
- Prefer composition/traits over deep inheritance.
- Throw a consistent exception type (
ValidationException).
Usage
Static helper
use Ksfraser\Validation\Assert; Assert::notEmptyString($bankAccountNumber, 'bankAccountNumber'); Assert::stringMaxLen($bankAccountNumber, 255, 'bankAccountNumber');
Trait (thin wrapper over Assert)
use Ksfraser\Validation\Traits\ValidatesStringTrait; final class Example { use ValidatesStringTrait; public function setCode($code) { $this->assertNotEmptyString($code, 'code'); $this->assertStringMaxLen($code, 20, 'code'); } }
Relationship to the split
This package was introduced as part of the long-running split of a legacy “ksf_modules_common” folder into multiple Composer packages.
If you are working inside that monorepo/workspace, see the local docs there:
LIBRARY_SPLIT_ANALYSIS.mdrepos/fa_classes/MIGRATION_NOTES.mdrepos/ksf_ModulesDAO/README.md
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-09