notarchid/laravel-smsgateway-me 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

notarchid/laravel-smsgateway-me

Composer 安装命令:

composer require notarchid/laravel-smsgateway-me

包简介

SMSGateway.Me for Laravel

README 文档

README

A PHP library to interact with SMSGateway.Me API.

Installation

Run the following composer command to automatically update your composer.json

composer require notarchid/laravel-smsgateway-me

Laravel 5.x:

After updating composer, add the ServiceProvider to the providers array in config/app.php so it can be loaded by Laravel.

'providers' => [
    // ...
    NotArchid\SmsGateway\ServiceProvider::class,
],

In order to use the SmsGateway facade, you need to register it to the facades array in config/app.php.

'facades' => [
    // ...
    'SmsGateway' => NotArchid\SmsGateway\Facade::class,
],

In order to use the SmsGateway.Me, you need to have an SMSGateway.Me's account and set your credentials by inserting this inside your config/services.php:

return [
    //...
    'smsgateway' => [
        'email' => 'your-email',
        'password' => 'your-password',
        'device_id' => 'your-device-id'
    ],
];

Usage

// Getting a list of your devices.
$sms = SmsGateway::devices()
                 ->get();
// Or 
$sms = SmsGateway::get('devices');

// Getting a list of your devices per page.
$page = 2;
$sms = SmsGateway::devices()
                 ->page($page)
                 ->get();

// Getting a details on a specific device.
$device_id = 33431;

$sms = SmsGateway::device($device_id)
                 ->get();
// Or 
$sms = SmsGateway::get('device', $device_id);

// Getting a list of your messages.
$sms = SmsGateway::messages()
                 ->get();
// Or 
$sms = SmsGateway::get('messages');

// Getting a list of your messages per page.
$page = 2;
$sms = SmsGateway::messages()
                 ->page($page)
                 ->get();

// Getting a details on s specific message.
$message_id = 82323;

$sms = SmsGateway::message($message_id)
                 ->get();
// Or
$sms = SmsGateway::get('message', $message_id);

// Sending message to a number.
$number = '+44771232343';
$message = 'Hello World!';

$sms = SmsGateway::to($number)
                 ->message($message)
                 ->send()
// Or
$sms = SmsGateway::send($number, $message);

// Sending message to many numbers.
$numbers = ['+44771232343', '+44771232344'];
$message = 'Hello World!';

$sms = SmsGateway::to($numbers)
                 ->message($message)
                 ->send();
// Or
$sms = SmsGateway::send($numbers, $message);

// Sending message to a contact.
$contact = 98123;
$message = 'Hello World!';

$sms = SmsGateway::contact($contact)
                 ->message($message)
                 ->send();
// Or
$sms = SmsGateway::send($contact, $message);

// Sending message to many contacts.
$contacts = [98123, 98124];
$message = 'Hello World!';

$sms = SmsGateway::contacts($contacts)
                 ->message($message)
                 ->send();
// Or
$sms = SmsGateway::send($contacts, $message);

// Sending many messages to many numbers or contacts.
$device1 = 33431;
$device2 = 33432;
$number = '+44771232343';
$contact = 98123;
$message1 = 'Hello there!';
$message2 = 'Good morning!';

$sms = SmsGateway::options([
                     [
                         'device' => $device1,
                         'number' => $number,
                         'message' => $message1,
                         'send_at' => strtotime('+1 minute'),
                         'expires_at' => strtotime('+10 minutes')
                     ], [
                         'device' => $device2,
                         'contact' => $number,
                         'message' => $message1,
                     ]
                 ])
                 ->send();
// Or
$sms = SmsGateway::send([
                     [
                         'device' => $device1,
                         'number' => $number,
                         'message' => $message1,
                         'send_at' => strtotime('+1 minute'),
                         'expires_at' => strtotime('+10 minutes')
                     ], [
                         'device' => $device2,
                         'contact' => $number,
                         'message' => $message1,
                     ]
                 ]);

// Getting a list of your contacts.
$sms = SmsGateway::contacts()
                 ->get();
// Or 
$sms = SmsGateway::get('contacts');

// Getting a list of your contacts per page.
$page = 2;
$sms = SmsGateway::contacts()
                 ->page($page)
                 ->get();

// Getting a details on a specific contact.
$contact_id = 33431;

$sms = SmsGateway::contact($contact_id)
                 ->get();
// Or 
$sms = SmsGateway::get('contact', $contact_id);

// Create a new contact.
$sms = SmsGateway::contact('John Doe', '+44771232343')
                 ->create();
// Or
$sms = SmsGateway::contact(['John Doe', '+44771232343'])
                 ->create();
// Or
$sms = SmsGateway::contact()
                 ->create('John Doe', '+44771232343');
// Or
$sms = SmsGateway::contact()
                 ->create(['John Doe', '+44771232343']);

// Adding options like send_at and expires_at is as simple as adding
// ->options(['send_at' => $timeToSend, 'expires_at' => $timeToExpire])
// to your command.
// Example:
$sms = SmsGateway::contact(98123)
                 ->message('Hello World!')
                 ->options([
                     'send_at' => strtotime('+1 minute'),
                     'expires_at' => strtotime('+10 minutes')
                 ])
                 ->send();

License

MIT

notarchid/laravel-smsgateway-me 适用场景与选型建议

notarchid/laravel-smsgateway-me 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 427 次下载、GitHub Stars 达 4, 最近一次更新时间为 2017 年 12 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「sms」 「gateway」 「laravel」 「smsgateway」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 notarchid/laravel-smsgateway-me 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 notarchid/laravel-smsgateway-me 我们能提供哪些服务?
定制开发 / 二次开发

基于 notarchid/laravel-smsgateway-me 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 427
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-12-26