bigbharatjain/laravel-clickatell
Composer 安装命令:
composer require bigbharatjain/laravel-clickatell
包简介
This package makes it easy to send sms using clickatell.com with Laravel 5.
README 文档
README
For Laravel 5.0 and above. This package allows integration with the new Clickatell website.
Introduction
Integrate Clickatell in your laravel application and send sms using this package.
Getting Started
To get started add the following package to your composer.json file.
composer require bigbharatjain/laravel-clickatell
Configuring
When composer installs Clickatell library successfully, register the Clickatell\ClickatellServiceProvider in your config/app.php configuration file.
'providers' => [ // Other service providers... Clickatell\ClickatellServiceProvider::class, ],
Also, add the Clickatell facade to the aliases array in your app configuration file:
'aliases' => [ // Other aliases 'Clickatell' => Clickatell\ClickatellFacade::class, ],
One more step to go....
It will publish a clickatell.php in config folder
Add set Clickatell api_key here or create an environment variable CLICKATELL_API_KEY
Usage
The new APIs only support sendMessage call and webhooks for outgoing and inbound messages via a RESTful interface.
namespace App\Http\Controllers; use Clickatell\Rest; use Clickatell\ClickatellException; class SendSmsController extends Controller { $clickatell = new \Clickatell\Rest(); // Full list of support parameters can be found at https://www.clickatell.com/developers/api-documentation/rest-api-request-parameters/ try { $result = $clickatell->sendMessage(['to' => ['27111111111'], 'content' => 'Message Content']); foreach ($result['messages'] as $message) { var_dump($message); /* [ 'apiMsgId' => null|string, 'accepted' => boolean, 'to' => string, 'error' => null|string ] */ } } catch (ClickatellException $e) { // Any API call error will be thrown and should be handled appropriately. // The API does not return error codes, so it's best to rely on error descriptions. var_dump($e->getMessage()); }
Status/Reply Callback
After configuring your webhooks/callbacks inside the developer portal, you can use the static callback methods to listen for web requests from Clickatell. These callbacks will extract the supported fields from the request body.
use Clickatell\Rest; use Clickatell\ClickatellException; // Outgoing traffic callbacks (MT callbacks) Rest::parseStatusCallback(function ($result) { var_dump($result); // This will execute if the request to the web page contains all the values // specified by Clickatell. Requests that omit these values will be ignored. }); // Incoming traffic callbacks (MO/Two Way callbacks) Rest::parseReplyCallback(function ($result) { var_dump($result); // This will execute if the request to the web page contains all the values // specified by Clickatell. Requests that omit these values will be ignored. });
Credits
PHP library for the Clickatell Platform
Issues/Contributions
Found a bug or missing a feature? Log it here and I will take a look.
bigbharatjain/laravel-clickatell 适用场景与选型建议
bigbharatjain/laravel-clickatell 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 35.11k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2017 年 10 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「clickatell」 「laravel-clickatell」 「sms-laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bigbharatjain/laravel-clickatell 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bigbharatjain/laravel-clickatell 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bigbharatjain/laravel-clickatell 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Monolog Handler for SMS messaging services such as Twilio, Clickatell and Plivo.
Clickatell notifications driver
PHP library for sending SMS through various gateways
Laminas module for sending SMS messages
Alfabank REST API integration
统计信息
- 总下载量: 35.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-16