hayrican/laravel-codec-fastsms
Composer 安装命令:
composer require hayrican/laravel-codec-fastsms
包简介
Codec Fast Sms Api Integration
README 文档
README
Laravel CODEC FAST SMS
This package provides easy and painless integration of Codec Messaging Platform API into your Laravel projects.
Requirements
Laravel >= 5.3
PHP >= 5.6.4
Installation
To get started, you should add the hayrican/laravel-codec-fastsms Composer dependency to your project:
composer require hayrican/laravel-codec-fastsms
Service Provider (Laravel Older 5.5)
If you are using later version of Laravel 5.5, you can skip this step.
Register provider on your config/app.php file.
'providers' => [ ..., HayriCan\CodecFastSms\CodecFastSmsServiceProvider::class, ]
Configuration
You should publish vendor for configuration file which has API Credentials and other configs.
$ php artisan vendor:publish --provider="HayriCan\CodecFastSms\CodecFastSmsServiceProvider"
Codec Credentials
Navigate to config/codecfastsms.php and enter your Codec API credentials in this file.
[
'username'=> "CODEC_USERNAME",
'password'=> "CODEC_PASSWORD",
'sender'=> "CODEC_SENDER",
]
Route Configuration
Default router prefix is api and middleware is api. In this section you can change prefix and middleware.
[
'route_prefix'=> 'api',
'middleware'=> ['api'],
]
Save SMS Requests
Default value of record comes false and it means you sms requests are not going to save on database.
If you want to save you requests on database, you can make this field true as shown below
[
'record'=> true
]
After changed the record value to true on config/codecfastsms.php file, you should migrate the migration.
$ php artisan migrate
And sms_records_table will appear on your database.
Package Usage
1.HTTP Request
You can send sms via a POST request to /codec-fastsms
Eg.1. Send a message to a number
Eg.2. Send a message to multiple numbers
Eg.3. Send multiple messages to multiple numbers
Post Required Parameters:
| Key | Value | Description |
|---|---|---|
phone |
5XXXXXXXXX | Phone number(s) to send multiple numbers you should put ~ between numbers. eg. 5XXXXXXXXX~5YYYYYYYYY |
messageContent |
Message Text | Message content(s) if you want to send different messages to different numbers you should put ~ between message contents. eg. MessageContent1~MessageContent2. NOTE: If you use this property, you should have equal number of phone and messageContent |
Post Optional Parameters:
| Key | Value | Description |
|---|---|---|
msgSpecialId |
Message_Title | This field use for searching on the Codec system records |
headerCode |
Header_Code | You can use this field for tracking messages from Codec Customer Service |
optionalParameters |
OPTIONAL_PARAM | Optional parameters |
2.Artisan Console
Eg.1. Send a message to a number
$ php artisan fastsms:send --phone='5XXXXXXXXX' --messageContent='Message Text'
Eg.2. Send a message to multiple numbers
$ php artisan fastsms:send --phone='5XXXXXXXXX~5YYYYYYYYY~5ZZZZZZZZZ' --messageContent='Message Text'
Eg.3. Send multiple messages to multiple numbers
$ php artisan fastsms:send --phone='5XXXXXXXXX~5YYYYYYYYY~5ZZZZZZZZZ' --messageContent='Message Text~Message Text2~Message Text3'
Command Required Parameters:
| Key | Value | Description |
|---|---|---|
--phone |
5XXXXXXXXX | Phone number(s) to send multiple numbers you should put ~ between numbers. eg. 5XXXXXXXXX~5YYYYYYYYY |
--messageContent |
Message Text | Message content(s) if you want to send different messages to different numbers you should put ~ between message contents. eg. MessageContent1~MessageContent2. NOTE: If you use this property, you should have equal number of phone and messageContent |
Command Optional Parameters:
| Key | Value | Description |
|---|---|---|
--msgSpecialId |
Message_Title | This field use for searching on the Codec system records |
--headerCode |
Header_Code | You can use this field for tracking messages from Codec Customer Service |
--optionalParameters |
OPTIONAL_PARAM | Optional parameters |
Author
Hayri Can BARÇIN
Email: Contact Me
License
This project is licensed under the MIT License - see the License File for details
hayrican/laravel-codec-fastsms 适用场景与选型建议
hayrican/laravel-codec-fastsms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 04 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 hayrican/laravel-codec-fastsms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hayrican/laravel-codec-fastsms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 37
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-19