PHP code example of aindot / extra-rules

1. Go to this page and download the library: Download aindot/extra-rules library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aindot / extra-rules example snippets


app()->setLocale('ar');

    $data = [
        'KuwaitiId' => $id,
    ];

    $validator = Validator::make($data, [
        'KuwaitiId' => [new KuwaitCivilId],
    ]);

    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

    use Aindot\ExtraRules\ExtraRules;
    use Aindot\ExtraRules\RuleType;

    $imei = (new ExtraRules)->generate('imei');
    $ibans = (new ExtraRules)->generateMany(RuleType::Iban, 5);

    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);
bash
php artisan vendor:publish --tag=extra-rules-translations
bash
php artisan extra-rules:magic "4111111111111111"
php artisan extra-rules:magic "4111111111111111" --rules=credit_card,imei
bash
php artisan extra-rules:generate imei
php artisan extra-rules:generate iban --count=5
bash
php artisan extra-rules:generate email
php artisan extra-rules:generate email --count=5