abusalam / laravel-smsgateway
Laravel 实现的短信网关
1.1.0
2023-10-03 12:02 UTC
Requires
- php: >=7.1
Requires (Dev)
- php: >=7.1
- illuminate/support: ^5.7
README
该 abusalam/laravel-smsgateway
包提供了从您的应用程序发送短信的简单易用的函数。与 CDAC 短信网关服务无缝协作。
以下是一个演示如何使用它的示例
use AbuSalam\SmsGateway; # Code... $smsGateway = new SmsGateway; $smsGateway->toRecipient('9876543210') ->withTemplateId('123456789012345678') ->withSms('Computer science is no more about computers than astronomy is about telescopes. - Edsger Dijkstra') ->sendSms(); # Code...
文档
您可以在这里找到文档。
安装
您可以通过 composer 安装此包
composer require "abusalam/laravel-smsgateway"
该包将自动注册自己。
您可以选择通过以下方式发布配置文件
php artisan vendor:publish --provider="AbuSalam\SmsGatewayServiceProvider" --tag="config"
这是发布配置文件的内容
return [ /* |-------------------------------------------------------------------------- | Default SMS Gateway Name |-------------------------------------------------------------------------- | | Here you may specify which of the SMS Gateways below you wish | to use as your default SMS Gateway for sending SMSs. Of course | you may use many connections at once using the SMS Gateway library. | */ 'default' => env('SMS_GATEWAY', 'local'), /* |-------------------------------------------------------------------------- | SMS Gateways |-------------------------------------------------------------------------- | | Here are each of the SMS Gateways setup for your application. | Of course, examples of configuring each SMS Gateway platform that is | supported by Laravel is shown below to make development simple. | | | All SMS Gateway work in Laravel is done through the PHP SMS facilities | so make sure you have the driver for your particular SMS Gateway of | choice installed on your machine before you begin development. | */ /*============================================================= = Default SMS Gateway API Configuration = =============================================================*/ 'cdacSms' => [ /* SMS Gateway API Endpoint Configurations */ 'apiEndpoint' => env('SMS_URL', 'https://msdgweb.mgov.gov.in/esms/sendsmsrequestDLT'), 'apiMobileNoParam' => env('SMS_MOBILE_NO_PARAM', 'mobileno'), 'apiSmsParam' => env('SMS_SMS_PARAM', 'content'), /* SMS Gateway Constant Parameter Configurations */ 'apiParams' => [ 'apiUserParam' => env('SMS_USERNAME_PARAM', 'username'), 'apiPassParam' => env('SMS_PASSWORD_PARAM', 'password'), 'apiSenderIdParam' => env('SMS_SENDER_ID_PARAM', 'senderid'), 'apiTemplateIdParam' => env('SMS_TEMPLATE_ID_PARAM', 'templateid'), 'apiSecureKeyParam' => env('SMS_API_KEY_PARAM', 'key'), 'apiServiceTypeParam' => env('SMS_SERVICE_TYPE_PARAM', 'smsservicetype'), ], 'apiValues' => [ 'apiUser' => env('SMS_USERNAME', 'dummyuser'), 'apiPass' => sha1(trim(env('SMS_PASSWORD', 'dummypass'))), 'apiSenderId' => env('SMS_SENDER_ID', 'DUMMY'), 'apiTemplateId' => env('SMS_TEMPLATE_ID', '01235468238656'), 'apiSecureKey' => env('SMS_API_KEY', 'top-secret-dummy-key'), 'apiServiceType' => env('SMS_SERVICE_TYPE_PARAM', 'singlemsg'), ] ], /*===== End of Default SMS Gateway API Configuration ======*/ 'local' => [ /* SMS Gateway API Endpoint Configurations */ 'apiEndpoint' => 'http://insp.local.host/api/sms', 'apiMobileNoParam' => 'recipient', 'apiSmsParam' => 'sms', /* SMS Gateway Parameter Configurations */ 'apiParams' => [ 'apiUserParam' => env('SMS_USERNAME_PARAM', 'username'), 'apiPassParam' => env('SMS_PASSWORD_PARAM', 'password'), 'apiSenderIdParam' => env('SMS_SENDER_ID_PARAM', 'senderid'), 'apiSecureKeyParam' => env('SMS_API_KEY_PARAM', 'key'), ], 'apiValues' => [ 'apiUser' => env('SMS_USERNAME', 'dummyuser'), 'apiPass' => sha1(trim(env('SMS_PASSWORD', 'dummypass'))), 'apiSenderId' => env('SMS_SENDER_ID', 'DUMMY'), 'apiSecureKey' => env('SMS_API_KEY', 'top-secret-dummy-key'), ] ], ];
许可
MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件。