PHP code example of mimmi20 / mezzio-setlocale-middleware

1. Go to this page and download the library: Download mimmi20/mezzio-setlocale-middleware 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/ */

    

mimmi20 / mezzio-setlocale-middleware example snippets



return [
    'middleware' => [
        // ...
        \Mimmi20\Mezzio\Middleware\SetLocaleMiddleware::class, // <-- Add this line
        // ... <-- any middleware or request handler wich uses the translator
    ],
];

    $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);