PHP code example of rnr1721 / multilingual-laravel

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

    

rnr1721 / multilingual-laravel example snippets




return [
    'languages' => [
        'en' => [
            'name' => 'English',
            'locale' => 'en_US',
            'rtl' => false
        ],
        'es' => [
            'name' => 'Español',
            'locale' => 'es_ES',
            'rtl' => false
        ]
    ],
    'default_language' => 'en',
    'url' => [
        'exclude_default_language' => true
    ],
    'preload_page_links_in_templates' => true
];

Route::multilingual(function () {
    Route::get('/', function () {
        return view('welcome');
    })->name('welcome');
    
    Route::get('/about', function () {
        return view('about');
    })->name('about');
});
shell
php artisan vendor:publish --provider="rnr1721\MultilingualLaravel\LaravelMultilingualServiceProvider" --tag="config"