mimmi20/mezzio-setlocale-middleware
最新稳定版本:2.0.3
Composer 安装命令:
composer require mimmi20/mezzio-setlocale-middleware
包简介
Provides a Middleware to set the Locale and the language to a translator
README 文档
README
Code Status
Introduction
This component provides middleware for Mezzio
and PSR-7 applications to set the locale and the language for a translator based on the HTTP_ACCEPT_LANGUAGE Header.
Requirements
This library requires
- PHP 8.3+.
- a translator
Installation
Run
composer require mimmi20/mezzio-setlocale-middleware
Add the Middleware to the pipeline
<?php return [ 'middleware' => [ // ... \Mimmi20\Mezzio\Middleware\SetLocaleMiddleware::class, // <-- Add this line // ... <-- any middleware or request handler wich uses the translator ], ];
If you need the Translator for the Routing, you have to add the Middleware in the Pipeline before the Routing.
$app->pipe(\Mimmi20\Mezzio\Middleware\SetLocaleMiddleware::class); // <-- Add this line // Register the routing middleware in the middleware pipeline. // This middleware registers the Mezzio\Router\RouteResult request attribute. $app->pipe(RouteMiddleware::class);
License
This package is licensed using the MIT License.
Please have a look at LICENSE.md.
统计信息
- 总下载量: 148.38k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-24