PHP code example of xiaosongshu / colorword

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

    

xiaosongshu / colorword example snippets

 
use Xiaosongshu\Colorword\Transfer;
/** 实例化字体颜色转化类 */
$transfer = new Transfer();
/** 输入需要转换颜色的文字内容,设置文字颜色,设置背景色 */
echo $transfer->getColorString("红字蓝底","red","blue");
echo "\r\n";
echo $transfer->info("提示信息");
echo "\r\n";
echo $transfer->error("错误信息");
echo "\r\n";
echo $transfer->line("普通信息");
echo "\r\n";