Extension for the Laravel validation class, (*1)
Installation
You can install this package quick and easy with Composer., (*2)
Require the package via Composer:, (*3)
$ composer require smart-twists/iranian-information-validator
The Validation class is built to work with the Laravel Framework. The integration is done in seconds., (*4)
Open your Laravel config file config/app.php
and add service provider in the $providers
array:, (*5)
'providers' => array(
...
SmartTwists\IranianInformationValidation\ValidationServiceProvider::class,
),
Usage with Laravel
The installed package provides the following additional validation rules
including their error messages., (*6)
iban
Checks for a valid International Bank Account Number (IBAN)., (*7)
creditcard
The given field must be a valid creditcard number., (*8)
isbn
The field under validation must be a valid International Standard Book Number (ISBN)., (*9)
isodate
The field under validation must be a valid date in ISO 8601 format., (*10)
nationalcode
The field under validation must be a valid national code., (*11)
ir_mobile
The field under validation must be a valid iranian mobile number., (*12)
ir_phone
The field under validation must be a valid iranian phone number., (*13)
zipcode
The field under validation must be a valid zip code., (*14)
Changing the error messages:
Add the corresponding key to /resources/lang/<language>/validation.php
like this:, (*15)
// example
'iban' => 'Please enter IBAN number!',
Or add your custom messages directly to the validator like described in the docs., (*16)
Usage outside of Laravel
- Validator::isIban - Checks if given value is valid International Bank Account Number (IBAN).
- Validator::isCreditcard - Checks if value is valid creditcard number.
- Validator::isIsbn - Checks if given value is valid International Standard Book Number (ISBN).
- Validator::isIsodate - Checks if given value is date in ISO 8601 format.
- Validator::isNationalcode - checks if given value is valid national code.
- Validator::isIrMobile - checks if given value is valid Iranian mobile number.
- Validator::isIrPhone - checks if given value is valid Iranian phone number.
- Validator::isZipcode - checks if given value is valid zip cide.
License
Intervention Validation Class is licensed under the MIT License., (*17)