1. Go to this page and download the library: Download karwana/messageformat 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/ */
karwana / messageformat example snippets
use Karwana\MessageFormat\MessageFormat;
$mf = new MessageFormat('/path/to/language/files/directory', 'en');
// Assume en.ini contains the following:
//
// [my_domain]
// my_key = "My mesage is \"{0}\"."
// my_other_key = "The colors of the rainbow."
// The following line will print 'My message is "Hello".' to output.
echo $mf->format('my_domain.my_key', array('Hello'));
$mf = new MessageFormat($ini_dir, 'en-gb', new MessageFormat($ini_dir, 'en'));
// Assume en-gb.ini contains the following:
//
// [my_domain]
// my_other_key = "The colours of the rainbow."
// The following line will print the British English message from en-gb.ini.
echo $mf->format('my_domain.my_other_key');
// The following line will print the fallback from en.ini.
echo $mf->format('my_domain.my_key', array('Yo'));
$mf->setCache(new Stash\Pool($my_stash_driver));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.