iamfarhad / validation
laravel persian validation package
Fund package maintenance!
iamfarhad
Installs: 12 940
Dependents: 0
Suggesters: 0
Security: 0
Stars: 25
Watchers: 5
Forks: 6
Open Issues: 0
Requires
- php: ^8.2
- illuminate/support: ^10.0|^11.0
Requires (Dev)
- laravel/pint: ^1.6
- orchestra/testbench: ^6.23|^7.0|^8.0|^9.0
- phpunit/phpunit: ^9.4|^10.1
- rector/rector: ^0.19.2
- dev-main
- v3.2.0
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.0
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.9
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- 2.1.1
- 2.1.0
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- v1.5.1
- 1.5
- v1.4
- v1.3
- v1.2
- V1.1
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-develop
This package is auto-updated.
Last update: 2024-11-12 15:50:50 UTC
README
Laravel Persian Validation
The Laravel Persian Validation package offers comprehensive validation for the Persian language, including validation for Persian alphabets, numbers, and other Persian-specific elements. This package allows developers to ensure that their Persian language input data meets the necessary validation criteria, enhancing the reliability and accuracy of their applications. With Laravel Persian Validation, developers can easily incorporate Persian language validation into their Laravel projects, providing a more inclusive and user-friendly experience for Persian-speaking users.
Requirement
- Laravel 10.x | 11.x
- PHP 8.1 | 8.2 | 8.3
Install
Via Composer
$ composer require iamfarhad/validation
This package is designed to automatically register itself without requiring any additional configuration.
Translations
If you would like to customize the translations for the Laravel Persian Validation package, you can use the following command to publish them into your project's resources/lang directory:
php artisan vendor:publish --provider="Iamfarhad\Validation\ValidationRulesServiceProvider" --tag="translations"
If you are using Laravel 9.x or later, the translations will be published to the /lang directory instead. Once the translations are published, you can modify them as needed to suit your project's requirements.
php artisan vendor:publish --provider="Iamfarhad\Validation\ValidationRulesServiceProvider"
Testing
You can run the tests with:
composer test
Usage
You can access to validation rules by passing the rules key according blew following table:
Persian Alphabet
Accept Persian language alphabet according to standard Persian, this is the way you can use this validation rule:
Validator::make( ['name' => 'فارسی'], ['name' => [new PersianAlpha()] );
Persian numbers
Validate Persian standard numbers (۰۱۲۳۴۵۶۷۸۹):
Validator::make( ['num' => '۰۱۲۳۴۵۶۷۸۹'], ['num' => [new PersianNumber()] );
Iran mobile phone
Validate Iran mobile phones (irancel, rightel, hamrah-e-aval, ...):
Validator::make( ['mob' => '09127777777'], ['mob' => [new Mobile()] );
Sheba number
Validate Iran bank sheba numbers:
Validator::make( ['sheba_number' => 'IR062960000000100324200001'], ['sheba_number' => [new Sheba()] );
Iran national code
Validate Iran national code (melli-code):
Validator::make( ['codeMelli' => '3240175800'], ['codeMelli' => [new NationalCode()] );
Payment card number
Validate Iran payment card numbers:
Validator::make( ['card' => '6274129005473742'], ['card' => [new CardNumber()] );
Iran postal code
Validate Iran postal code:
Validator::make( ['postal' => '16719735744'], ['postal' => [new PostalCode()] );
// in a `FormRequest` public function rules() { return [ 'NationalCode' => ['required', new NationalCode()], ]; }
Team
This component is developed by the following person(s)
Support This Project
Great! It's always helpful to have more contributors to a package. Here are a few ways you can contribute to the package completion:
- Report Issues: If you find any bugs or issues with the package, you can report them on the package's GitHub repository. Be sure to provide detailed steps to reproduce the issue and any relevant code snippets.
- Submit Pull Requests: If you have a fix for a bug or an improvement to the package, you can submit a pull request on the package's GitHub repository. Be sure to follow the guidelines for contributing and to test your changes thoroughly.
- Improve Documentation: If you find any gaps in the package's documentation, you can contribute by improving the existing documentation or adding new documentation. You can do this by submitting a pull request on the package's GitHub repository.
- Spread the Word: You can help the package by spreading the word about it on social media, developer forums, and other channels. This can help attract more contributors and users to the package.
Remember that contributing to open-source projects like this package is a collaborative effort, and every little bit helps. Thank you for considering contributing!
License
The Laravel persian validation Module is open-sourced software licensed under the MIT license