https://github.com/edofre/yii2-validators
Yii2 validators that I frequently need in projects
https://github.com/edofre/yii2-validators
Last synced: 6 months ago
JSON representation
Yii2 validators that I frequently need in projects
- Host: GitHub
- URL: https://github.com/edofre/yii2-validators
- Owner: Edofre
- License: mit
- Created: 2016-04-16T21:42:52.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-02-05T15:44:18.000Z (over 9 years ago)
- Last Synced: 2024-12-30T15:38:31.544Z (over 1 year ago)
- Language: PHP
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGE.MD
- License: LICENSE.md
Awesome Lists containing this project
README
# Yii2 validators
[](https://packagist.org/packages/edofre/yii2-validators)
[](https://packagist.org/packages/edofre/yii2-validators)
[](https://packagist.org/packages/edofre/yii2-validators)
[](https://packagist.org/packages/edofre/yii2-validators)
[](https://packagist.org/packages/edofre/yii2-validators)
## Installation
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
To install, either run
```
$ php composer.phar require edofre/yii2-validators "V1.0.2"
```
or add
```
"edofre/yii2-validators": "V1.0.2"
```
to the ```require``` section of your `composer.json` file.
## ZipCodeValidator
### Insert into rules as following
```php
/**
* @inheritdoc
*/
public function rules()
{
return [
...
['zip_code', 'edofre\validators\ZipCodeValidator'],
...
];
}
```
## PriceValidator
### Insert into rules as following
```php
/**
* @inheritdoc
*/
public function rules()
{
return [
...
['price', 'edofre\validators\PriceValidator'],
...
];
}
```