PHP code example of mateodioev / multi-lang

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

    

mateodioev / multi-lang example snippets


use Mateodioev\MultiLang\Cache\InMemoryCache;
use Mateodioev\MultiLang\Lang;

$config = \Mateodioev\MultiLang\Config::instance()
    ->withCache(new InMemoryCache()) // Optional;
Lang::setup(
    dir: __DIR__ . '/resources/lang',
    config: $config
);

// If the key does not exist it will return null
Lang::get('es')->data('welcome')?->format(['full_name' => 'Mateo']);
// Output: Bienvenido Mateo a nuestro sitio web

Lang::compareData();