PHP code example of mrgear / laravel-persian-validator

1. Go to this page and download the library: Download mrgear/laravel-persian-validator 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/ */

    

mrgear / laravel-persian-validator example snippets


return [
    'custom' => [
        'alpha_space_fa' => 'This field can only contain Persian letters and spaces.',
        'alpha_spaces' => 'This field can only contain letters and spaces.',
        'jalali_date' => 'The entered date is not valid.',
        'phone_number' => 'The phone number is not valid.',
        'ir_phone_number' => 'The phone number must start with 09 and be 11 digits long.',
    ],
];

$request->validate([
    'name' => 'alpha_space_fa',
]);

$request->validate([
    'name' => 'alpha_spaces',
]);

$request->validate([
    'birthdate' => 'jalali_date',
]);

$request->validate([
    'phone' => 'phone_number',
]);

$request->validate([
    'phone' => 'ir_phone_number',
]);