Download the PHP package fallahalireza/persian-tools-laravel without Composer

On this page you can find all versions of the php package fallahalireza/persian-tools-laravel. 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 persian-tools-laravel

🇮🇷 Persian Tools for Laravel

A powerful Laravel validation package for Persian/Iranian applications including national IDs, banking, mobile numbers, license plates, Jalali dates and more.

یک پکیج قدرتمند و جامع لاراول برای اعتبارسنجی متن فارسی، شناسه‌های ایرانی، بانکداری، تاریخ شمسی، پلاک خودرو و بیشتر

PHP Version Laravel Latest Version License

--- ### 🌍 Language / زبان

---

🇬🇧 English Documentation

Table of Contents


✨ Features

This package provides a rich set of Laravel validation rules tailored for Persian/Iranian applications. Below is a quick comparison with other available packages:

Feature This Package Others
کد اقتصادی (Economic Code) validation ✅ ❌
پلاک خودرو (License Plate) validation ✅ ❌
شماره حساب بانکی (Bank Account Number) ✅ ❌
Bank detection from card BIN ✅ ❌
Type-safe PersianRule Enum ✅ ❌
MobileFormat Enum ✅ ❌
Luhn algorithm for bank cards ✅ ✅
Full IBAN (Sheba) checksum ✅ ✅
National ID checksum ✅ ✅
Persian digit normalization ✅ partial
Bilingual error messages (fa/en) ✅ partial

📋 Requirements

Dependency Version
PHP ^8.2
Laravel ^11.0, ^12.0, or ^13.0

📦 Installation

Install via Composer:

The package registers itself automatically via Laravel's package auto-discovery — no manual provider registration is needed.

Publish Config (Optional)

Publish Language Files (Optional)


⚙️ Configuration

After publishing, edit config/persian-tools.php:


🚀 Usage

There are three ways to use this package:

1. String-based Rules (requires register_rules = true)

The simplest approach — use rule names as strings:

2. Class-based Rules (always available)

Use rule classes directly for full control over parameters:

3. Type-safe Enum (always available)

Leverage the PersianRule enum to avoid typos in rule names:


📋 All Validation Rules

🔤 Persian Text & Numbers

String Rule Class Description Valid Example Invalid Example
persian_alpha PersianAlpha Persian letters, punctuation & spaces سلام علی‌رضا Hello
persian_alpha_num PersianAlphaNum Persian letters + Persian digits سلام۱۲۳ Hello 123
persian_alpha_eng_num PersianAlphaEngNum Persian letters + Persian/English digits سلام123 Hello
persian_num PersianNum Persian digits only ۱۲۳۴۵ 12345
persian_not_accept PersianNotAccept Reject any Persian content Hello 123 سلام

📅 Persian Dates

String Rule Parameters Description
persian_date separator, convertPersianNumbers Valid Jalali (Shamsi) date
persian_date_between startDate, endDate, separator, convertPersianNumbers Date within a range (exclusive)
persian_month — Valid Persian month name
persian_day — Valid Persian day of week name

Examples:


📱 Phone Numbers

String Rule Class Parameters Valid Examples
ir_mobile IranianMobile format, convertPersianNumbers 09123456789, +989123456789
ir_phone IranianPhone withAreaCode, areaCodeSeparator, withCountryCodeFormat, convertPersianNumbers 02112345678
ir_phone_area_code IranianPhoneAreaCode convertPersianNumbers 021, 031, 044

Mobile Format options:

Phone with area code:


🪪 Identifiers

String Rule Class Description Valid Example
ir_national_id IranianNationalId 10-digit National ID with checksum 0013542419
ir_company_id IranianCompanyId Legal Entity National ID (شناسه ملی اشخاص حقوقی) 14007650912
ir_economic_code IranianEconomicCode 14-digit Economic Code (کد اقتصادی) ⭐ 14004800101010

🏦 Banking

String Rule Class Description
ir_bank_card IranianBankCardNumber 16-digit bank card (Luhn algorithm + BIN detection)
ir_iban IranianIban IBAN / Sheba number with full checksum validation
ir_bank_account IranianBankAccountNumber Bank account number ⭐

Advanced banking usage:


📍 Other

String Rule Class Parameters Description
ir_postal_code IranianPostalCode separator 10-digit Iranian postal code
ir_license_plate IranianLicensePlate allowMotorcycle Car & motorcycle license plate ⭐

Examples:


🔢 Enums Reference

PersianRule Enum

Type-safe enum mapping all rule names:

MobileFormat Enum


🌐 Localization

The package ships with Persian (fa) and English (en) error messages.

Set the default locale in config/app.php:

Override per request:

To customize messages, publish the language files and edit:


🧪 Testing

Run with coverage:

Run static analysis:

Format code:


🤝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Commit your changes: git commit -m 'Add my feature'
  4. Push to the branch: git push origin feature/my-feature
  5. Open a Pull Request

Please make sure all tests pass and code follows PSR-12 standards before submitting.


📄 License

The MIT License (MIT). See LICENSE for more information.

Developed with ❤️ by Alireza Fallah



# 🇮🇷 مستندات فارسی ## فهرست مطالب - [ویژگی‌ها](#-ویژگیها) - [پیش‌نیازها](#-پیشنیازها) - [نصب](#-نصب) - [پیکربندی](#️-پیکربندی) - [نحوه استفاده](#-نحوه-استفاده) - [مرجع قوانین اعتبارسنجی](#-تمام-قوانین-اعتبارسنجی) - [متن و اعداد فارسی](#-متن-و-اعداد-فارسی) - [تاریخ شمسی](#-تاریخ-شمسی) - [شماره تلفن](#-شماره-تلفن) - [شناسه‌ها](#-شناسهها) - [بانکداری](#-بانکداری) - [سایر](#-سایر) - [مرجع Enum‌ها](#-مرجع-enumها) - [بومی‌سازی](#-بومیسازی) - [تست‌ها](#-تستها) - [مشارکت](#-مشارکت) - [مجوز](#-مجوز) --- ## ✨ ویژگی‌ها این پکیج مجموعه‌ای غنی از **قوانین اعتبارسنجی لاراول** مختص برنامه‌های فارسی/ایرانی ارائه می‌دهد. مقایسه با سایر پکیج‌های مشابه: | ویژگی | این پکیج | سایرین | |---|---|---| | اعتبارسنجی کد اقتصادی | ✅ | ❌ | | اعتبارسنجی پلاک خودرو | ✅ | ❌ | | اعتبارسنجی شماره حساب بانکی | ✅ | ❌ | | تشخیص بانک از BIN کارت | ✅ | ❌ | | `PersianRule` Enum ایمن از نظر نوع | ✅ | ❌ | | `MobileFormat` Enum | ✅ | ❌ | | الگوریتم Luhn برای کارت بانکی | ✅ | ✅ | | اعتبارسنجی کامل IBAN (شبا) | ✅ | ✅ | | اعتبارسنجی کد ملی با checksum | ✅ | ✅ | | تبدیل اعداد فارسی به انگلیسی | ✅ | ناقص | | پیام‌های خطا دو زبانه (fa/en) | ✅ | ناقص | --- ## 📋 پیش‌نیازها | وابستگی | نسخه | |---|---| | PHP | `^8.2` | | Laravel | `^11.0`، `^12.0`، یا `^13.0` | --- ## 📦 نصب از طریق Composer نصب کنید: پکیج از طریق قابلیت auto-discovery لاراول به صورت خودکار ثبت می‌شود — نیازی به ثبت دستی provider نیست. ### انتشار فایل پیکربندی (اختیاری) ### انتشار فایل‌های زبان (اختیاری) --- ## ⚙️ پیکربندی پس از انتشار، فایل `config/persian-tools.php` را ویرایش کنید: --- ## 🚀 نحوه استفاده سه روش برای استفاده از این پکیج وجود دارد: ### روش اول: استفاده رشته‌ای (نیاز به `register_rules = true`) ساده‌ترین روش — استفاده از نام قوانین به صورت رشته: ### روش دوم: استفاده از کلاس (همیشه در دسترس) استفاده مستقیم از کلاس‌های قانون برای کنترل کامل پارامترها: ### روش سوم: استفاده از Enum ایمن (همیشه در دسترس) از `PersianRule` enum برای جلوگیری از اشتباه تایپی استفاده کنید: --- ## 📋 تمام قوانین اعتبارسنجی ### 🔤 متن و اعداد فارسی | قانون رشته‌ای | کلاس | توضیح | مثال معتبر | مثال نامعتبر | |---|---|---|---|---| | `persian_alpha` | `PersianAlpha` | حروف فارسی، علائم نگارشی و فاصله | `سلام علی‌رضا` | `Hello` | | `persian_alpha_num` | `PersianAlphaNum` | حروف فارسی + اعداد فارسی | `سلام۱۲۳` | `Hello 123` | | `persian_alpha_eng_num` | `PersianAlphaEngNum` | حروف فارسی + اعداد فارسی/انگلیسی | `سلام123` | `Hello` | | `persian_num` | `PersianNum` | فقط اعداد فارسی | `۱۲۳۴۵` | `12345` | | `persian_not_accept` | `PersianNotAccept` | رد هر محتوای فارسی | `Hello 123` | `سلام` | --- ### 📅 تاریخ شمسی | قانون رشته‌ای | پارامترها | توضیح | |---|---|---| | `persian_date` | `separator`، `convertPersianNumbers` | تاریخ شمسی معتبر | | `persian_date_between` | `startDate`، `endDate`، `separator`، `convertPersianNumbers` | تاریخ در محدوده (غیر شامل) | | `persian_month` | — | نام ماه شمسی معتبر | | `persian_day` | — | نام روز هفته فارسی معتبر | **مثال‌ها:** --- ### 📱 شماره تلفن | قانون رشته‌ای | کلاس | پارامترها | مثال معتبر | |---|---|---|---| | `ir_mobile` | `IranianMobile` | `format`، `convertPersianNumbers` | `09123456789`، `+989123456789` | | `ir_phone` | `IranianPhone` | `withAreaCode`، `areaCodeSeparator`، `withCountryCodeFormat`، `convertPersianNumbers` | `02112345678` | | `ir_phone_area_code` | `IranianPhoneAreaCode` | `convertPersianNumbers` | `021`، `031`، `044` | **گزینه‌های فرمت موبایل:** **تلفن ثابت با کد منطقه:** --- ### 🪪 شناسه‌ها | قانون رشته‌ای | کلاس | توضیح | مثال معتبر | |---|---|---|---| | `ir_national_id` | `IranianNationalId` | کد ملی ۱۰ رقمی با checksum | `0013542419` | | `ir_company_id` | `IranianCompanyId` | شناسه ملی اشخاص حقوقی | `14007650912` | | `ir_economic_code` | `IranianEconomicCode` | کد اقتصادی ۱۴ رقمی ⭐ | `14004800101010` | --- ### 🏦 بانکداری | قانون رشته‌ای | کلاس | توضیح | |---|---|---| | `ir_bank_card` | `IranianBankCardNumber` | کارت بانکی ۱۶ رقمی (الگوریتم Luhn + تشخیص BIN) | | `ir_iban` | `IranianIban` | شماره شبا با اعتبارسنجی checksum کامل | | `ir_bank_account` | `IranianBankAccountNumber` | شماره حساب بانکی ⭐ | **استفاده پیشرفته از بانکداری:** --- ### 📍 سایر | قانون رشته‌ای | کلاس | پارامترها | توضیح | |---|---|---|---| | `ir_postal_code` | `IranianPostalCode` | `separator` | کد پستی ۱۰ رقمی | | `ir_license_plate` | `IranianLicensePlate` | `allowMotorcycle` | پلاک خودرو و موتورسیکلت ⭐ | **مثال‌ها:** --- ## 🔢 مرجع Enum‌ها ### `PersianRule` Enum Enum ایمن از نظر نوع که نام تمام قوانین را نگاشت می‌کند: ### `MobileFormat` Enum --- ## 🌐 بومی‌سازی این پکیج با پیام‌های خطای **فارسی (fa)** و **انگلیسی (en)** ارائه می‌شود. زبان پیش‌فرض را در `config/app.php` تنظیم کنید: تغییر به ازای درخواست: برای سفارشی‌سازی پیام‌ها، فایل‌های زبان را منتشر کرده و ویرایش نمایید: --- ## 🧪 تست‌ها اجرا با پوشش کد: تحلیل استاتیک: فرمت کد: --- ## 🤝 مشارکت مشارکت شما خوشایند است! لطفاً مراحل زیر را دنبال کنید: 1. ریپازیتوری را Fork کنید 2. یک شاخه ویژگی بسازید: `git checkout -b feature/my-feature` 3. تغییرات خود را Commit کنید: `git commit -m 'Add my feature'` 4. شاخه را Push کنید: `git push origin feature/my-feature` 5. یک Pull Request باز کنید لطفاً قبل از ارسال مطمئن شوید که تمام تست‌ها pass می‌شوند و کد از استانداردهای PSR-12 پیروی می‌کند. --- ## 📄 مجوز مجوز MIT. برای اطلاعات بیشتر [LICENSE](LICENSE) را ببینید. **توسعه داده شده با ❤️ توسط [علیرضا فلاح](https://github.com/fallahalireza)**

All versions of persian-tools-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0 || ^12.0 || ^13.0
illuminate/validation Version ^11.0 || ^12.0 || ^13.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 fallahalireza/persian-tools-laravel contains the following files

Loading the files please wait ...