https://github.com/yiier/yii2-validators
Collection of useful validators for Yii Framework 2.0
https://github.com/yiier/yii2-validators
yii2-validators
Last synced: 2 months ago
JSON representation
Collection of useful validators for Yii Framework 2.0
- Host: GitHub
- URL: https://github.com/yiier/yii2-validators
- Owner: yiier
- Created: 2018-05-29T08:40:51.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-08-21T07:27:58.000Z (almost 5 years ago)
- Last Synced: 2024-04-14T05:40:59.847Z (about 1 year ago)
- Topics: yii2-validators
- Language: PHP
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Validators for Yii2
================
Validators for Yii2[](https://packagist.org/packages/yiier/yii2-validators)
[](https://packagist.org/packages/yiier/yii2-validators)
[](https://packagist.org/packages/yiier/yii2-validators)
[](https://packagist.org/packages/yiier/yii2-validators)Installation
------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist yiier/yii2-validators "*"
```or add
```
"yiier/yii2-validators": "*"
```to the require section of your `composer.json` file.
Method Listing
-----**中国身份证号码验证**
```php
public function rules()
{
return [
// ...
['id_card', \yiier\validators\IdCardValidator::class],
// code
];
}
```**Array Validator**
```php
public function rules()
{
return [
// ...
['product_ids', \yiier\validators\ArrayValidator::class],
// code
];
}
```**Phone Validator**
```php
public function rules()
{
return [
// ...
['phone', \yiier\validators\PhoneValidator::class],
// code
];
}
```**Money Validator**
```php
public function rules()
{
return [
// ...
['amount', \yiier\validators\MoneyValidator::class],
['amount', \yiier\validators\MoneyValidator::class, 'allowsNegative' => true],
// code
];
}
```……