PHP code example of zagovorichev / laravel-languages

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

    

zagovorichev / laravel-languages example snippets


'providers' => [
    // ...
    Zagovorichev\Laravel\Languages\LanguageServiceProvider::class,
]

protected $middlewareGroups = [
        'web' => [
            // ...
            \Zagovorichev\Laravel\Languages\Http\Middleware\LanguagesMiddleware\LanguagesMiddleware::class,
        ],
    ];

'domainRegExp' => [
    'reg' => '|^(http://)([a-z]{2})[\.]{0,1}(example\.com.*)$|ui',
    'langPart' => 2,
]

'pathRegExp' => [
     'reg' => '|([a-z]{2})(/.*)|ui',
     'langPart' => 1, // lang part will be replaced with new lang
 ],