junholee14/laravel-unicode-normalizer
最新稳定版本:v1.0.1
Composer 安装命令:
composer require junholee14/laravel-unicode-normalizer
包简介
A set of features to make working with unicode normalization in Laravel
README 文档
README
Introduction
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.
Requirements
- PHP >= 8.1
- Laravel >= 10
intlPHP extension
Installation
To 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.
Usage
Middleware
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, ];
Validation Rule
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()], ]);
统计信息
- 总下载量: 614
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-02