alishpersian/persian-validation

Alish Persian Validation

5.3.x-dev 2021-10-04 11:27 UTC

This package is auto-updated.

Last update: 2024-09-04 17:52:01 UTC


README

Alish Persian Validation 提供波斯字母、数字等的验证。

要求

  • Laravel 5.*
  • PHP 5.5 及以上

许可证

Alish Persian Validation 是开源软件,遵循MIT 许可证

安装

通过 Composer

$ composer require Alishpersian/Validation

配置

将以下提供者添加到 config/app.php 中的 providers 部分

Alishpersian\Validation\AlishValidationServiceProvider::class

vendor:publish

您可以运行 vendor:publish 命令,以便在 resources/lang/validation 路径上拥有包的自定义语言文件

用法

您可以通过传递以下表格中的规则键来访问验证规则

Alish Alpha

接受符合标准波斯语的波斯语字母,您可以使用此验证规则的方式如下

$input = [ 'فارسی' ];

$rules = [ 'alish_alpha' ];

Validator::make( $input, $rules );

波斯数字

验证波斯标准数字(۰۱۲۳۴۵۶۷۸۹)

$input = [ '۰۱۲۳۴۵۶۷۸۹' ];

$rules = [ 'alish_num' ];

Validator::make( $input, $rules );

波斯字母数字

验证波斯字母数字

$input = [ 'فارسی۱۲۳۴۵۶۷۸۹' ];

$rules = [ 'alish_alpha_num' ];

Validator::make( $input, $rules );

伊朗手机

验证伊朗手机(irancel, rightel, hamrah-e-aval, ...)

$input = [ '09381234567' ];

$rules = [ 'iran_mobile' ];

Validator::make( $input, $rules );

Sheba 数字

验证伊朗银行 Sheba 数字

$input = [ 'IR042960000000100789200001' ];

$rules = [ 'sheba' ];

Validator::make( $input, $rules );

伊朗国家代码

验证伊朗国家代码(melli-code)

$input = [ '3240175800' ];

$rules = [ 'melli_code' ];

Validator::make( $input, $rules );

支付卡号码

验证伊朗支付卡号码

$input = [ '6274129005473742' ];

$rules = [ 'card_number' ];

Validator::make( $input, $rules );

伊朗邮政编码

验证伊朗邮政编码

$input = [ '167197-35744' ];

$rules = [ 'iran_postal_code' ];

Validator::make( $input, $rules );


$input = [ '16719735744' ];

$rules = [ 'iran_postal_code' ];

Validator::make( $input, $rules );

更多

以下是 Alishpersian 验证规则用法的完整列表

Validator::make( $request->all(), [

  'name'          => 'alish_alpha|unique|max:25', // Validate Persian alphabet, unique and max to 25 characters

  'age'           => 'alish_num|required',  // Validate Persian numbers and check it's required

  'city'          => 'alish_alpha_num|min:10',  // Validate persian alphabet & numbers at least 10 digit accepted

  'mobile'        => 'iran_mobile', // Validate mobile number

  'sheba_number'  => 'sheba', // Validate sheba number of bank account

  'melli_code'    => 'melli_code',  // Validate melli code number

  'latin_name'    => 'is_not_persian',  // Validate alphabet and doesn't contain Persian alphabet or number

  'your_array'    => 'limited_array:2', // Validate your array variable and must be contian 2 member or lesser

  'url'           => 'a_url', // Validate url

  'domain'        => 'a_domain',  // Validate domain

  'more'          => 'more:10', // Validate value be more than parameter

  'less'          => 'less:10', // Validate value be less than parameter

  'phone'         => 'iran_phone', // Validate phone number

  'card_number'   => 'card_number', // Validate payment card number

  'address'       => 'address' // validate Persian, English and ... alphabet, Persian and English numbers and some special characters

  'postal_code'   => 'iran_postal_code' // validate iran postal code format

  'package_name'  => 'package_name' // validate APK package name


]);