PHP code example of tyler36 / localization

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

    

tyler36 / localization example snippets


php artisan vendor:publish --provider=tyler36/localization
config/localization.php
app/Http/Kernel.php
session_key => locale

    $key = config('localization.session_key', 'locale');
    session([$key => request()->get($key)]);

// routes/web.php
Route::get('/locale/{locale}', [
    'as' => 'localization.session',
    'uses' => '\Tyler36\Localization\Controller\LocaleController@session'
]);

// blade - create links
route('localization.session', [config('localization.session_key') => $locale]