mimmi20/mezzio-setlocale-middleware 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

Latest Stable Version Latest Unstable Version License

Code Status

codecov Average time to resolve an issue Percentage of issues still open Mutation testing badge

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-05-24