1. Go to this page and download the library: Download sleep-cat/opencc-php 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/ */
use AlphaSnow\OpenCC\Command;
use AlphaSnow\OpenCC\OpenCC;
$command = new Command('/usr/bin/opencc','/usr/share/opencc');
$openCC = new OpenCC($command);
$result = $openCC->convert('天氣乍涼人寂寞,光陰須得酒消磨。且來花裏聽笙歌。','t2s.json');
print_r($result);
// 天气乍凉人寂寞,光阴须得酒消磨。且来花里听笙歌。