dealnews/constraints
最新稳定版本:v3.0.0
Composer 安装命令:
composer require dealnews/constraints
包简介
Type constraint checking library
README 文档
README
A library for testing primitive and abstract data types in PHP with type juggling.
Supported Primitive Types
- Integer
- String
- Array
- Double (aka float)
- Boolean
- Any defined PHP class
Supported Abstract Types
- Bytes
- US Currency
- Date
- DateTime
- Length
- Range
- Time
- URL
- URL Path
- Year
Extendable
The base Constraint class can be extended to add new abstract types.
Example
// A very simple example $constraint = \DealNews\Constraints\Constraint::init(); $value = "1"; try { $value = $constraint->check($value, ["type" => "integer"]); // $value will now be integer 1 } catch (\DealNews\Constraints\ConstraintException $e) { echo $e->getMessage(); }
统计信息
- 总下载量: 10.63k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-03-10