Download the PHP package sadegh19b/laravel-persian-validation without Composer

On this page you can find all versions of the php package sadegh19b/laravel-persian-validation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-persian-validation

Laravel Persian Validation

Laravel Persian Validation provides validation rules for Persian alphabet, numbers and Iranian-specific data formats. It offers comprehensive validation for Persian (Shamsi) dates, phone numbers, national IDs, bank cards, Sheba numbers, postal codes, and company identifiers. Supporting Laravel 11+ and PHP 8.2+, it seamlessly integrates with Laravel's validation system.

Requirement

If you want to use the package in older versions of Laravel (6, 7, 8, 9, 10) and PHP (>= 7.4), you can use the version 1.x.

Installation

[!IMPORTANT] Read the upgrade guide before upgrading to the version 2.0

Install the package with Composer:

Publish

If you want to change the configs, you can publish the config file. Run the below command on your terminal (the config file will be published to config/persian-validation.php):

If you want to use validations custom messages, you can publish language file. Run the below command on your terminal (the language file will be published to lang/{locale}/persian-validation.php. supported locales: en, fa):

Configurations

The package provides below configuration options in config/persian-validation.php:

Usage

When the register_rules is true in configuration:

When the rules not registered in laravel validation container:

Rules

Note: All parameters in below tables are in order to be used, must be passed to the rule constructor.

Persian Text and Numbers

Rule Description Parameters Valid Examples Invalid Examples
persian_alpha Persian alphabetic characters with diacritics, spaces & ZWNJ (حروف فارسی و علائم نگارشی و فاصله و نیم فاصله) - سلام، علی‌رضا Hello, Test
persian_alpha_num Persian alphabetic with diacritics, spaces, ZWNJ & Persian numbers (حروف فارسی و علائم نگارشی و فاصله و اعداد فارسی) convertPersianNumbers سلام۱۲۳، علی‌رضا۴۵۶ Hello 123, Test
persian_alpha_eng_num Persian alphabetic with diacritics, spaces, ZWNJ, Persian & English numbers (حروف فارسی و علائم نگارشی و فاصله و اعداد فارسی و انگلیسی) convertPersianNumbers سلام123، علی‌رضا۴۵۶ Hello 123, Test
persian_num Only Persian numbers (اعداد فارسی) - ۱۲۳۴۵۶۷۸۹۰ 1234567890
persian_not_accept Rejects Persian characters and numbers (موارد فارسی غیرقابل قبول) - Hello 123, Test سلام، تست۱۲۳

Parameters Details

Persian Dates

Rule Description Parameters Valid Examples Invalid Examples
persian_date Validates Shamsi dates (تاریخ شمسی) separator, convertPersianNumbers 1403/01/01, ۱۴۰۳/۱/۱ 2024/03/20
persian_date_between Validates date is between two Shamsi dates (تاریخ مابین دو تاریخ شمسی) startDate, endDate, separator, convertPersianNumbers 1403/01/01 (if between range) 1402/12/29 (if outside range)
persian_date_between_or_equal Validates date is between or equal to two Shamsi dates (تاریخ مابین یا برابر با دو تاریخ شمسی) startDate, endDate, separator, convertPersianNumbers 1403/01/01 (if between range) 1402/12/29 (if outside range)
persian_date_between_year Validates year is between two Shamsi years (تاریخ مابین اسال های شمسی) startYear, endYear, separator, convertPersianNumbers 1403/01/01 (if year in range) 1402/01/01 (if year outside range)
persian_date_between_or_equal_year Validates year is between or equal to two Shamsi years (تاریخ مابین یا برابر با سال های شمسی) startYear, endYear, separator, convertPersianNumbers 1403/01/01 (if year in range) 1402/01/01 (if year outside range)
persian_day Validates the persian date name (روزهای هفته) - Allows (شنبه, یکشنبه, دوشنبه, سه‌شنبه, چهارشنبه, پنج‌شنبه, جمعه) Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday
persian_month Validates the persian month name (ماه‌های شمسی) - Allows (فروردین, اردیبهشت, خرداد, تیر, مرداد, شهریور, مهر, آبان, آذر, دی, بهمن, اسفند) January, February, March, April, May, June, July, August, September, October, November, December

Note: The dates validate between 1000 and 1600 years.

Note: The validation values for persian_day and persian_month rules can be customized by modifying the corresponding values in the language file (lang/{locale}/persian-validation.php).

Parameters Details

Phone Numbers

Rule Description Parameters Valid Examples Invalid Examples
ir_mobile Iranian mobile numbers (شماره موبایل) format, convertPersianNumbers 09123456789, +989123456789, ۰۹۱۲۳۴۵۶۷۸۹ 091234567, 08123456789
ir_phone Iranian landline phone numbers (شماره تلفن ثابت) withAreaCode, areaCodeSeparator, withCountryCodeFormat, convertPersianNumbers 02112345678, 021-12345678 0211234, 09123456789
ir_phone_area_code Iranian state area phone codes (کد استان) convertPersianNumbers 021, 031, ۰۲۱ 099, 1234

Parameters Details

National and Company Identifiers

Rule Description Parameters Valid Examples Invalid Examples
ir_national_id Iranian National ID (کد ملی) convertPersianNumbers 0013542419, ۰۰۱۳۵۴۲۴۱۹ 012345678, 0123456789a
ir_company_id Iranian Company ID (شناسه ملی اشخاص حقوقی) convertPersianNumbers 14007650912, ۱۴۰۰۷۶۵۰۹۱۲ 1234567890, 123456789012

Parameters Details

Banking

Rule Description Parameters Valid Examples Invalid Examples
ir_bank_card_number Iranian Bank Card Numbers (شماره کارت بانکی) separator, convertPersianNumbers 6037991234567890, 6037-9912-3456-7890 6037991234567, 603799123456789a
ir_iban Iranian IBAN (شماره شبا) withPrefix, separator, convertPersianNumbers IR062960000000100324200001, IR06-2960-0000-0010-0324-2000-01 IR062960000000, IR06296000000010032420000a

Parameters Details

Postal Codes

Rule Description Parameters Valid Examples Invalid Examples
ir_postal_code Iranian Postal Codes (کد پستی) separator, convert_persian_numbers 1234567890, 12345-67890, ۱۲۳۴۵۶۷۸۹۰ 123456789, 12345678901

Parameters Details

License

The Laravel Persian Validation package is open-sourced software licensed under the MIT license. Please see License File for more information.


All versions of laravel-persian-validation with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
illuminate/support Version ^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sadegh19b/laravel-persian-validation contains the following files

Loading the files please wait ....