bryce / openapi
开放API
1.4
2020-01-03 04:12 UTC
Requires
- php: >=7.1.1
README
通过开放接口,开发者可以轻松快速地访问发送短信或发送电子邮件等函数。
现有功能
- 发送短信
- 发送电子邮件
如何使用?
安装
composer repuire bryce/openapi
发送短信验证码
<?php /** * @author Bryce<lushaoming6@gmail.com> * @date 2019/12/12 */ require_once 'vendor/autoload.php'; $sms = new \Bryce\OpenApi\Sms(); $sms->setClientId('Your client id'); $sms->setClientKey('Your client key'); if ($sms->send('188****1019')) exit('Success'); else exit('Failure');
- 您应有发送短信的权限
- 每个手机号码每分钟只能发送1条短信,每天最多发送5条短信。
验证短信验证码
<?php /** * @author Bryce<lushaoming6@gmail.com> * @date 2019/12/12 */ require_once 'vendor/autoload.php'; $mailer = new \Bryce\OpenApi\Sms(); $sms->setClientId('Your client id'); $sms->setClientKey('Your client key'); if ($mailer->verifyCode('188****1019', 434307)) exit('Success'); else exit('Failure');
发送电子邮件
<?php /** * @author Bryce<lushaoming6@gmail.com> * @date 2019/12/12 */ require_once 'vendor/autoload.php'; $mailer = new \Bryce\OpenApi\Mailer(); $mailer->setClientId('Your client id'); $mailer->setClientKey('Your client key'); if ($mailer->send('To email', 'subject', 'body')) exit('Success'); else exit('Failure');
- 您应有发送邮件的权限
- 目前不支持发送附件