1. Go to this page and download the library: Download compositephp/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/ */
compositephp / localization example snippets
use Composite\Localization\AbstractLocalization;
use Composite\Localization\Language;
class Localization extends AbstractLocalization
{
public function __construct(Language $language)
{
parent::__construct(
language: $language,
sourcePath: '/directory/to/your/locale/files',
);
}
public function general(string $text, array $placeholders = []): string
{
return $this->get('general', $text, $placeholders);
}
public function profile(string $text, array $placeholders = []): string
{
return $this->get('profile', $text, $placeholders);
}
//other categories
//...
}