PHP code example of mrgear / laravel-persian-normalizer

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


Route::middleware(['mrgear-persian-normalizer'])->group(function () {
    Route::post('/some-route', [SomeController::class, 'someMethod']);
});

return [
    'except' => ['password', 'email'],
];

use MRGear\PersianNormalizer\Facades\Normalizer;

$data = request()->all();
$normalizedData = Normalizer::normalizeAll($data);

return response()->json($normalizedData);

$request = [
    'name' => 'محمد',
    'email' => '[email protected]',
    'phone' => '۰۹۱۲۳۴۵۶۷۸۹',
];

$request = [
    'name' => 'محمد',  // no change if no normalization needed
    'email' => '[email protected]',
    'phone' => '09123456789',
];
bash
php artisan vendor:publish --provider="MRGear\PersianNormalizer\PersianNormalizerServiceProvider" --tag="config"