A set of features to make working with unicode normalization in Laravel
junholee14/laravel-unicode-normalizer is a Laravel package for a set of features to make working with unicode normalization in laravel.
It currently has 1 GitHub stars and 943 downloads on Packagist (latest version v1.0.1).
Install it with composer require junholee14/laravel-unicode-normalizer.
Discover more Laravel packages by junholee14
or browse all Laravel packages to compare alternatives.
Last updated
The Laravel Unicode Normalizer package provides a simple and efficient way to normalize Unicode characters in your Laravel application. This package includes middleware for easy normalization of incoming requests and a validation rule to ensure that data is normalized before processing.
intl PHP extensionTo install the package, run the following command in your Laravel project:
composer require junholee14/laravel-unicode-normalizer
After installation, you can publish the package configuration using:
php artisan vendor:publish --provider="Junholee14\LaravelUnicodeNormalizer\UnicodeNormalizationProvider"
The default normalization form is NFC. You can change this in the published configuration file.
The NormalizeUnicode middleware automatically normalizes all incoming request data to the specified Unicode form. To use it, simply add the middleware to your route or middleware group in app/Http/Kernel.php:
// app/Http/Kernel.php
protected $middlewareAliases = [
...
'normalizeUnicode' => \Junholee14\LaravelUnicodeNormalizer\Middlewares\NormalizeUnicode::class,
];
The package also provides a normalize_unicode validation rule to ensure that data is in normalized form. You can use this rule like any other Laravel validation rule:
$request->validate([
'input_field' => ['required', 'string', new NormalizedUnicode()],
]);