- <?php
- declare(strict_types=1);
- namespace App\Tools;
- use Overtrue\Pinyin\Pinyin;
- class PinyinHelper
- {
- public static function getFirstLetter(string $string): string
- {
- $pinyin = new Pinyin();
- return strtolower(implode('', $pinyin->abbr($string)->toArray()));
- }
- }
|