patricpoba/mnotify
Composer 安装命令:
composer require patricpoba/mnotify
包简介
API for sending sms using mnotify.com as the service provider
README 文档
README
This package enables sending of sms from your laravel application using mNotify.com as a service provider. The Voice feature will be added in future releases
Installation
Download and install composer (from http://www.getcomposer.org/download) if you do not have it already.
Method 1: Require this package with composer:
composer require patricpoba/mnotify
Method 2: Add the following to your project composer.json file
{
"require": {
"patricpoba/mnotify": "0.1.*"
}
}
and run this command
composer update
After updating composer, add the ServiceProvider to the providers array in config/app.php
Laravel <= 5.4 :
If you're using laravel 5.5, you can skip this step.
PatricPoba\Mnotify\MnotifyServiceProvider::class,
Add the facade of this package to the $aliases array.
'Sms' => PatricPoba\Mnotify\Facades\Sms::class,
Configuration
Before you can start sending sms you will need to set your api key and default sender ID in your /.env file
You can find your api key here https://apps.mnotify.net/api/api
These config files can be changed from the laravel application. See examples
<!-- /.env file -->
MNOTIFY_SMS_API_KEY=YourKeyGoesHere
MNOTIFY_SENDER_ID=MyApp
Usage
Below is a basic usage guide for sending sms and checking sms balance of your mnotify account.
Sending Sms
Sms messages can be sent using the facade or the class file. In this example, we are going to send sms from our laravel application using mnotify.com's sms api
# Basic sending(uses api_key set in .env file) Sms::send('02XXXXXXXXX', 'Testing test'); # To use a different api key, Sms::setApiKey('API_KEY_GOES_HERE')->send('0275799028', 'Testing App'); # To customise sender Id, # NB: sender Id must not be more than 11 characters Sms::from('CompanyName')->send('02XXXXXXXX', 'Testing App');
Sceduling
A date and time in Y-m-d H:i:s format. This datetime should only be added when you want to schedule the message at a later time
$dateTime = \Carbon\Carbon::now()->addMinutes(30); // format: 2017-05-02 00:59:00 Smd::schedule($dateTime, '0275799028', 'Testing Application')
Checking Sms balance
This returns your mnotify.com sms balance.
Sms::balance(); # To check the balance using an api key different from the one set in the .env file, Sms::setApiKey('API_KEY_GOES_HERE')->balance();
Contributing
Thank you for considering contributing to the package! To contribute, fork this repository, write some code and then submit a pull request to the develop branch. :-)
License
This package is open-sourced software licensed under the MIT license.
patricpoba/mnotify 适用场景与选型建议
patricpoba/mnotify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 793 次下载、GitHub Stars 达 9, 最近一次更新时间为 2017 年 10 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 patricpoba/mnotify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 patricpoba/mnotify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 793
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-25