1. Go to this page and download the library: Download yosina-lib/yosina 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/ */
yosina-lib / yosina example snippets
use Yosina\TransliterationRecipe;
use Yosina\Yosina;
// Create a recipe with multiple transformations
$recipe = new TransliterationRecipe(
replaceSpaces: true,
replaceCircledOrSquaredCharacters: true,
replaceCombinedCharacters: true,
kanjiOldNew: true,
toFullwidth: true
);
$transliterator = Yosina::makeTransliterator($recipe);
// Use it with various special characters
$input = "①②③ ⒶⒷⒸ ㍿㍑㌠㋿"; // circled numbers, letters, ideographic space, combined characters
$result = $transliterator($input);
echo $result; // "(1)(2)(3) (A)(B)(C) 株式会社リットルサンチーム令和"
// Convert old kanji to new
$oldKanji = "舊字體";
$result = $transliterator($oldKanji);
echo $result; // "旧字体"
// Convert half-width katakana to full-width
$halfWidth = "テストモジレツ";
$result = $transliterator($halfWidth);
echo $result; // "テストモジレツ"