ibonly / laravel-etextemail
基于 etextmail api 构建的 laravel 应用
Requires
- php: >=5.5.9
- illuminate/support: 5.2.*
Requires (Dev)
- codeclimate/php-test-reporter: dev-master
- mockery/mockery: ^0.9.5
- phpunit/phpcov: 2.*
- phpunit/phpunit: 4.*
- satooshi/php-coveralls: ^1.0
- scrutinizer/ocular: ~1.1
This package is not auto-updated.
Last update: 2024-09-14 19:42:09 UTC
README
#Laravel-EtextMail Laravel-etextmail 基于 etextmail api (http://etextmail.com) 构建,该 api 是一个 SMS 网关,用于向 GSM 和 CDMA 网络上的手机发送短信,包括尼日利亚的 Glo、MTN、Zain、Etisalat、Starcomms、Visafone 以及全球范围内的服务。
要获取 laravel-etextmail 的最新版本,请简单地进行以下操作:
composer require ibonly\laravel-etextmail
或者包含
"ibonly/laravel-etextmail: 1.0.*"
到您的 composer.json 文件中,然后运行 composer update
或 composer install
一旦安装了 Laravel EtextMail,您需要注册服务提供者。打开 config/app.php
文件,并在 providers
键中添加以下内容:
Ibonly\EtextMail\EtextMailServiceProvider::class,
此外,还可以如此注册 Facade:
'aliases' => [ ... 'EtextMail' => Ibonly\EtextMail\Facades\EtextMail::class, ... ]
#配置(步骤 1)使用以下命令发布配置文件
php artisan vendor:publish --provider="Ibonly\EtextMail\EtextMailServiceProvider"
一个包含默认配置设置的 etextmail.php
文件将被添加到 config/
目录。
return [ 'senderid' => getenv('ETEXTMAIL_SENDER'), 'username' => getenv('ETEXTMAIL_EMAIL'), 'password' => getenv('EXTEXTMAIL_PASSWORD'), 'url' => getenv('ETEXTMAIL_URL'), ];
##配置(步骤 2)打开您的 .env 文件,并添加您的 SMS 发送者 ID
、etextmail 邮箱
、etextmail 密码
和 etextmail URL
ETEXTMAIL_SENDER=xxxxx ETEXTMAIL_EMAIL=xxxxx EXTEXTMAIL_PASSWORD=xxxxx ETEXTMAIL_URL=http://mail.etextmail.com
请注意,经销商应使用他们自己的 URL。
##使用
use EtextMail; class SMS { /** * @return float */ public function getSMSBalance() { dd(EtextMail::getCreditBalance()) } /** * @param $message [the message to be processed] * @return int */ public function messageCount($message) { dd(EtextMail::getMessageCount($message)); } /** * @param $message [the message to be processed] * @return int */ public function characterCount($message) { dd(EtextMail::getCharacterCount($message)); } /** * @param $destination [reciever's mobile number] * @param message [the message to be processed] * @return boolean */ public function sendSMS($destination, $message) { dd(EtextMail::sendMessage($destination, $message)); } /** * @param $destination [reciever's mobile number] * @param $message [the message to be processed] * @param $longSMS [number of pages] * @return boolean */ public function sendLongSMS($destination, $message, $longSMS) { dd(EtextMail::sendMessage($destination, $message, $longSMS)) } }
测试
$ vendor/bin/phpunit test
贡献
要贡献并扩展此包的范围,请查阅 CONTRIBUTING 文件,了解详细的贡献指南。请随时提出任何问题或关注点。
致谢
Laravel-etextmail 由 Ibraheem ADENIYI
创建和维护。