seymuromarov/sms
Composer 安装命令:
composer require seymuromarov/sms
包简介
Laravel api for sending sms from different providers.
关键字:
README 文档
README
Laravel api for sending sms from different providers and auth via sms
Currently Supported Sms.ru , Clockwork , MSM, Smsapi,Nexmo, Clickatell
Requirements
Installation
Require package:
composer require seymuromarov/sms
Now add the service provider in config/app.php file:
'providers' => [
// ...
Seymuromarov\Sms\SmsServiceProvider::class,
],
after this add alias in config/app.php file:
'aliases' => [
//...
'Sms' => Seymuromarov\Sms\Facades\Sms::class
],
Add following values to your .env
SMS_USER=
SMS_PASS=
SMS_FROM=
SMS_PROVIDER=
SMS_PROVIDER => provider name msm , clockwork , smsRu , smsApi ,nexmo,clickatell
SMS_PASS - provider password(key on clockwork,apiKey on clickatell, api_id on smsRu,MD5password on smsApi)
SMS_FROM - from optional for some providers
SMS_USER - Username optional for some providers
Note for Nexmo :api_secret is SMS_PASS, api_key is SMS_USER
use command (optional):
php artisan migrate
use this command if you want to save sent messages or if you want to logging in via sms
optional values to your .env
SMS_DB=false
SMS_DB - if you set true it will log all sent messages on db (you must migrate migrations),default is false
For using Sms Sender use this:
Sms::send($number,$message);
Sms::send(441234567890,"HELLO WORLD");
Sms::send([441234567890,994513073940,441234567891],"HELLO WORLD");
Note:Nexmo does not support bulk message
for checking balance use (only for Clockwork,SmsApi):
Sms::balance();
Now supports logging in via sms without password , you can use it for 2FA auth or just simple faster logging in via laravel
If you won't use logging in via sms then u don't need to read from here on
optional .env values
SMS_DB_PHONE=phone
SMS_DB_PHONE - it is for logging in purpose ,write your phone number column name here (you must set it on users table),default is phone
For example : if you have default users table just add phone_number column on it and change env value like this:
SMS_DB_PHONE=phone_number
for sending message for login purpose use this
Sms::login_code($number, $message = null, $len = 6);
Sms::login_code(994513073940, "this is your verification code : "); // it will send message like this this is your verification code : 254129
Sms::login_code(994513073940, "use code : ",9); // it will send message like this this is your verification code : 325475698
For verification of code and logging in use this
Sms::check_login($number, $code, $id = null);
Sms::login_code(994513073940, "254129"); // it will find user and login with user whose number is 994513073940 and login via phone number
// If u don't have phone table on users , we have solution for this too , just send id which u want to login for example:
Sms::login_code(994513073940, "254129",24); // it will find user whose id is 24 and login via id
it will return true if logged in successful, false if there was a problem
seymuromarov/sms 适用场景与选型建议
seymuromarov/sms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 125 次下载、GitHub Stars 达 2, 最近一次更新时间为 2017 年 09 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「sms」 「provider」 「send」 「laravel」 「nexmo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 seymuromarov/sms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 seymuromarov/sms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 seymuromarov/sms 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Time provider, providing consistent current date, time, datetime and timezone across the request.
An Zend Expressive module for loading ZF2 or ZF3 modules.
A fast and intuitive dependency injection container.
A PSR-7 compatible library for making CRUD API endpoints
Planning Center OAuth2 Provider for Laravel Socialite
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
统计信息
- 总下载量: 125
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-09-27