aindot / extra-rules
A package that include extra rules for Laravel, Kuwait Civil ID validation, ISBN10, ISBN13 and more in development.
Package info
pkg:composer/aindot/extra-rules
Requires
- php: ^8.4
- illuminate/contracts: ^10.0||^11.0||^12.0||^13.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
This package is auto-updated.
Last update: 2026-07-30 14:21:50 UTC
README
A package that include extra validation rules for Laravel, this package approach focuses on actual usage, for example the ISBN test must validate against different real-world examples.
The following are the validation rules that are in development or have been developed.
- Kuwaiti Civil ID - Official personal identification number for residents of Kuwait.
- ISBN10 - Legacy 10-character identifier for books.
- ISBN13 - Modern 13-digit identifier for books and related media.
- ISNI - Unique identifier for authors, artists, and other contributors.
- ISWC - Unique identifier for compositions.
- ISTC - Unique identifier for textual works across editions and formats.
- ISAN - Unique identifier for films, TV programmes, and audiovisual works.
- ISMN - Unique identifier for printed composition publications.
- ISRC - Unique identifier for sound recordings and sound videos.
- URN - Persistent, location-independent uniform resource name.
- NBN - National bibliography number used by national libraries.
- DOI - Persistent identifier for digital objects such as papers and datasets.
- ISSN - Unique identifier for serial publications such as journals.
- EAN8 - 8-digit retail barcode for small product packaging.
- EAN13 - 13-digit retail barcode used worldwide at point of sale.
- Email - RFC 5322 compliant email address validation.
- GTIN13 - 13-digit global trade item number for products and packaging.
- IMEI - Unique identifier for a mobile handset or cellular device.
- IMEISV - Device identity plus software version number (SVN).
- IMSI - A unique identifier for a mobile network subscriber.
- ICCID - A unique serial number identifying a sim card.
- MEID - Unique identifier for CDMA mobile devices.
- ESN - Legacy electronic serial number for older CDMA devices.
- MAC address - Unique hardware address for a network interface.
- E.164 - International telephone number including country code.
- IBAN - Cross-border bank account identifier.
- BIC/SWIFT - Bank identifier code used in financial transfers.
- Credit card - Payment card number validated with Luhn.
- CVV - 3- or 4-digit card security code.
- UPC-A - 12-digit North American retail product barcode.
- GTIN14 - 14-digit trade item number for cases and pallets.
- SSCC - Serial shipping container code for logistics units.
- VIN - 17-character vehicle identification number.
- CPF - Brazilian individual taxpayer registry number.
- CNPJ - Brazilian company taxpayer registry number.
- SSN - US Social Security Number format check.
- Passport MRZ - TD3 passport machine-readable zone line check.
- UUID - Universally unique identifier in 8-4-4-4-12 form.
- ULID - 26-character lexicographically sortable unique ID.
- JWT - JSON Web Token header.payload.signature structure.
- Hex color - CSS hexadecimal color value.
- Slug - URL-friendly lowercase hyphenated string.
- Emirates ID - Official 15-digit UAE identity number.
- Iqama - Saudi 10-digit national ID or resident Iqama number.
- Egyptian NID - Egyptian 14-digit national identity number.
- UPC-E - Compressed UPC barcode for small retail packages.
- GTIN8 - 8-digit global trade item number for small products.
- ITF-14 - 14-digit carton barcode using GTIN-14 structure.
Installation
You can install the package via composer:
composer require aindot/extra-rules
Translations
English and Arabic validation messages are included. Publish them if you want to customize the wording:
php artisan vendor:publish --tag=extra-rules-translations
Set the app locale to use Arabic messages:
app()->setLocale('ar');
Usage
$data = [ 'KuwaitiId' => $id, ]; $validator = Validator::make($data, [ 'KuwaitiId' => [new KuwaitCivilId], ]);
Magic guess
use Aindot\ExtraRules\ExtraRules; use Aindot\ExtraRules\RuleType; $matches = (new ExtraRules)->magic('4111111111111111'); // all matching RuleType cases $matches = (new ExtraRules)->magic('4111111111111111', ['credit_card', RuleType::Imei]); // only test the provided candidates
php artisan extra-rules:magic "4111111111111111" php artisan extra-rules:magic "4111111111111111" --rules=credit_card,imei
Generate samples
use Aindot\ExtraRules\ExtraRules; use Aindot\ExtraRules\RuleType; $imei = (new ExtraRules)->generate('imei'); $ibans = (new ExtraRules)->generateMany(RuleType::Iban, 5);
php artisan extra-rules:generate imei php artisan extra-rules:generate iban --count=5
Email validation and generation
use Aindot\ExtraRules\ExtraRules; use Aindot\ExtraRules\RuleType; $validator = Validator::make($data, [ 'email' => [new \Aindot\ExtraRules\Rules\Email], ]); $email = (new ExtraRules)->generate('email'); $emails = (new ExtraRules)->generateMany(RuleType::Email, 5);
php artisan extra-rules:generate email php artisan extra-rules:generate email --count=5
Credits
License
The MIT License (MIT). Please see License File for more information.