PHP code example of benconstable / laravel-localize-middleware

1. Go to this page and download the library: Download benconstable/laravel-localize-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/ */

    

benconstable / laravel-localize-middleware example snippets


// config/app.php

'providers' => [
    BenConstable\Localize\LocalizeServiceProvider::class
]

// app/Http/Kernel.php

protected $middleware = [
    \BenConstable\Localize\Http\Middleware\Localize::class
];

'driver' => [
    'cookie',
    'parameter'
]

// config/app.php

'aliases' => [
    'Localizer' => BenConstable\Localize\DeterminerFacade::class
]

$locale = Localizer::determineLocale($request);

$ php artisan vendor:publish --provider="BenConstable\Localize\LocalizeServiceProvider"