Download the PHP package jp3cki/yii2-extra-validator without Composer
On this page you can find all versions of the php package jp3cki/yii2-extra-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-extra-validator
yii2-extra-validator
Requirements
- PHP 8.0 or later
- Yii framework 2.0
- Some php extensions is required:
- PCRE extension (also required by Yii)
- mbstring extension (also required by Yii)
- intl extension (also required by Yii in some action)
Install
- Set up Composer, the de facto standard package manager.
- Set up your new Yii app if needed.
php composer.phar require jp3cki/yii2-extra-validator
Usage
This package includes these validators:
- AvailableUrlValidator
- ConvertCharacterWidthFilterValidator
- HiraganaValidator
- IdnToPunycodeFilterValidator
- KatakanaValidator
- ReCaptchaValidator
- StrictUrlValidator
- TwitterAccountValidator
- ZenginNameFilterValidator
- ZenginNameValidator
AvailableUrlValidator
AvailableUrlValidator
will check that the URL is accessible.
Validation will failed if remote server returns 4xx(client error) or 5xx(server error).
Model class example:
ConvertCharacterWidthFilterValidator
ConvertCharacterWidthFilterValidator
is a filter validator that provides normalization of character width.
This validator may useful for Japanese input.
このフィルタバリデータを利用すると、半角カタカナの入力を全角に変換したり、全角英数を半角英数に変換したり、カタカナをひらがなに変換したりできます。
KatakanaValidatorと組み合わせて使用すると便利かもしれません。
Model class example:
HiraganaValidator
HiraganaValidator
validates value that input is hiragana-only string.
このバリデータは入力がひらがなのみで構成されていることを検証します。名前のふりがな入力等に利用できます。
カタカナの検証を行いたい場合はKatakanaValidatorを使用します。
Model class example:
IdnToPunycodeFilterValidator
IdnToPunycodeFilterValidator
is a filter validator that provides convert IDN to Punycoded domain name.
This validator may useful when you store URL to the database in ASCII charset.
Model class example:
Controller class example:
KatakanaValidator
KatakanaValidator
validates value that input is katakana-only string.
このバリデータは入力がカタカナのみで構成されていることを検証します。名前のフリガナ入力等に利用できます。
ひらがなの検証を行いたい場合はHiraganaValidatorを使用します。
Model class example:
ReCaptchaValidator
ReCaptchaValidator
validates reCAPTCHA (API ver.2) input.
First, you must visit reCAPTCHA website and create your keys.
After reCAPTCHA registration, you can get Site key
and Secret key
.
Open @app/config/params.php
file and add these keys like below:
In the HTML output phase, you can use the HTML snippet in the website of reCAPTCHA.
In validation phase, you can set $_POST['g-recaptcha-response']
parameter to our validator and verification.
StrictUrlValidator
StrictUrlValidator
validates URL that checks strictly than core validator implementation.
Input | UrlValidator(core) | StrictUrlValidator(this) |
---|---|---|
http://example.com/ |
valid | valid |
http://example.com/あ |
valid | invalid |
http://example.comあ/ |
valid | invalid |
Model class example:
TwitterAccountValidator
TwitterAccountValidator
validates Twitter's @id
name(aka screen name).
By default, our validator repels blacklisted account name like mentions
.
Model class example:
Currently, we do not support client-side(JavaScript) validation.
ZenginNameFilterValidator
ZenginNameValidator
These validators are useful if you are dealing with a bank account for the Japanese app.
ZenginNameFilterValidator
は入力された文字列を(自動判断できる範囲で)全銀用の文字列に変換します。
実際の利用では、口座名義などにフィルタをかけ、実際のバリデータである ZenginNameValidator
へデータへ引き継ぐことになります。
ZenginNameValidator
は入力された文字列が全銀用の文字列として妥当か検査します。
このバリデータは例えば全角カタカナを受け付けないので、 ZenginNameFilterValidator
を事前に通して入力の補助とできます。
(半角カタカナで入力を強制するのは非人道的です。また、長音の代わりにハイフンを使用する必要があるなど人間が徹底して守るにはつらいです)
Model class example:
License
Contributing
Patches and/or report issues are welcome.
- Please create new branch for each issue or feature. (should not work in master branch)
- Please write and run test.
$ make test
- Coding style is PSR-2.
- Please run check-style for static code analysis and coding rule checking.
$ make check-style
- Please run check-style for static code analysis and coding rule checking.
- Please clean up commits.
- Please create new pull-request for each issue or feature.
- Please gazing the results of Travis-CI and other hooks.
- Please use Japanese or very simple English to create new pull-request or issue.
I strongly hope rewrite my poor English.
All versions of yii2-extra-validator with dependencies
ext-intl Version *
ext-mbstring Version *
ext-pcre Version *
jp3cki/mb_str_replace Version ^4.0.2
yiisoft/yii2 Version ^2.0.50
yiisoft/yii2-httpclient Version ^2.0.15