wontonee / verifiedsms
该项目包含一个用于Google验证短信的Laravel包。
5.0.3
2021-10-13 17:40 UTC
Requires
- google/apiclient: ^2.11
- mdanter/ecc: ^1.0
README
这是一个为Google商业通信API和验证短信API开发的Laravel包。在开始安装此包之前,您必须在您的环境中完成以下事项:
- 您的代理必须经过Google验证,并且您必须拥有Google合作伙伴账户。
- 公钥/私钥或如果您没有公钥和私钥,请参阅以下链接:https://developers.google.com/business-communications/verified-sms/guides/build/keys
- 您必须有一个有效的API服务账户或API密钥,用于验证短信API和商业通信API。
安装
- 使用命令提示符运行此包:
composer require wontonee/verifiedsms
- 现在该包已准备好在您的项目中使用。让我们通过以下示例进行测试:创建任何控制器
php artisan make:controller TestController
- 在您的
http/controller/keys
中创建一个keys文件夹(将.pem和service account json文件放入此文件夹中)。 - 打开您的
TestController.php
并编写以下代码
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Wontonee\Verifiedsms\Http\Controllers\VerifiedsmsController; class TestController extends Controller { /** * Testing Controller */ public function testing() { $agentId = "VERIFIED_AGENT_ID"; $privateKeyPath = __DIR__ . "/keys/private-key-P-384.PEM"; $serviceAccountLocation = __DIR__ . "/keys/wontonee-493caec367b7.json"; //REPLACE WITH YOUR SERVICE ACCOUNT JSON $apiKey = ""; // REPLACE WITH API KEY IF SERVICE ACCOUNT NOT USING $sms = "This is my first message testing by Saju For wontonee."; $mobileno = "+919811381218"; // Mobile no should be with countrycode and mobile no $storehasing = new VerifiedsmsController($agentId, $privateKeyPath, $serviceAccountLocation, $apiKey, $sms,$mobileno); $storehasing->GoogleHashstore(); // Response check if it having success 200 then send sms from your gateway } }
如需帮助或定制,请访问 https://www.wontonee.com 或发送邮件至 hello@wontonee.com