PHP code example of rohit / laravel-localization

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

    

rohit / laravel-localization example snippets


    'providers` => [
        .......
        .......
        Rohit\LaravelLocalization\LaravelLocalizationServiceProvider::class
    ]

    'aliases' => [
        ......
        ......
        'Localization' => Rohit\LaravelLocalization\Facades\LaravelLocalization::class
    ]

    return [
        // Add any language you want to support and comes as prefix in the url
        'all_locales' => [
            'en',
            'th'
        ],
        'default_locale' => 'th', // Default locale will not be shown in the url
    ];

    protected $routeMiddleware = [
        ........
        ........
        'localization' => \Rohit\LaravelLocalization\Middleware\LanguageHandler::class,
    ]

    Route::group([
        'prefix' => Localization::setLocale(),
        'middleware' => ['localization']
    ], function() {
        // All your routes here
    });