dannyvilla/1s2u-sms 问题修复 & 功能扩展

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

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

dannyvilla/1s2u-sms

Composer 安装命令:

composer require dannyvilla/1s2u-sms

包简介

It is a package which makes it possible to send messages (SMS) through the gateway of https://www.1s2u.com

README 文档

README

It is a package which makes it possible to send messages (SMS) through the gateway of https://www.1s2u.com

Installation

Use the package manager composer to install 1s2u-sms.

composer require dannyvilla/1s2u-sms

The OneServiceToYouSMSServiceProdiver is auto-discovered and registered by default, but if you want to register it yourself:

Add the ServiceProvider in config/app.php :

'providers' => [
    /*
     * Package Service Providers...
     */
    Oxanfoxs\OneServiceToYouSMS\Provider\OneServiceToYouSMSServiceProdiver::class,

]

Add the Facade in config/app.php :

'aliases' => [
    ...
    
    'MessageApi' => Oxanfoxs\OneServiceToYouSMS\Facades\MessageApi::class,

]

You should publish the package to get access to config file :

php artisan vendor:publish --provider="Oxanfoxs\OneServiceToYouSMS\Provider\OneServiceToYouSMSServiceProdiver"

This will create a new config file named config/1s2u.php. Then you can update credentials within the 1s2u configuration file.

     ...

    'username' => 'your-username-here',

     ....

    'password' => 'your-password-here',

Usage

1s2u api allows to send 2 types of message.

  • Simple text message : this type contains only GSM 03.38 characters
  • Unicode message : this type use UCS-2 charset.
Send an auto-detected type message.
$response = MessageApi::setMessage('Hello word')
                      ->setSenderId('SMS')
                      ->setMobileNumbers(['123456789', '234567891'])
                      ->appendNumber('123456678')
                      ->send();
Send a simple text message.
$response = MessageApi::setMessage('Hello word', MessageApi::SIMPLE_TEXT_MESSAGE)
                      ->setSenderId('FROM')
                      ->setMobileNumbers(['1234567890'])
                      ->send();
Send a unicode message.
$response = MessageApi::setMessage('Hello word', MessageApi::UNICODE_MESSAGE)
                      ->setSenderId('FROM')
                      ->setMobileNumbers(['1234567890'])
                      ->send();
Send a flash message.
$response = MessageApi::setMessage('Hello word')
                      ->setSenderId('FROM')
                      ->setMobileNumbers(['1234567890'])
                      ->shouldFlash(true)
                      ->send();
Checking credit.

\Oxanfoxs\OneServiceToYouSMS\MessageApi::checkCredit() method allows to check credits balance.

$response = MessageApi::checkCredit()

To get more information about the response please check the official documentation here

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

统计信息

  • 总下载量: 200
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固