二次封裝overtrue/easy-sms元件,相容hyperf2.0支援協程化,使用簡單

h1712715552發表於2020-12-22

專案地址:
github.com/hyperf-libraries/sms

1.安裝

composer require hyperf-libraries/sms:2.0.0

2.釋出配置

php bin/hyperf.php vendor:publish hyperf-libraries/sms

3.基本呼叫

use HyperfLibraries\Sms\Contract\SmsInterface;
use Hyperf\Utils\ApplicationContext;

$easySms = ApplicationContext::getContainer()->get(SmsInterface::class);
$result = $easySms->send(18888888888, [
    'content'  => '{1}為您的登入驗證碼,請於5分鐘內填寫',
    'template' => '12345',
    'data' => [
        'code' => 1234
    ],
]);
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章