2017 © Pedro Peláez
 

libaray alidayu-php-sdk

Provides an implelmentation of Ali Dayu SMS SDK that uses Guzzle 6 and Composer

image

softbread/alidayu-php-sdk

Provides an implelmentation of Ali Dayu SMS SDK that uses Guzzle 6 and Composer

  • Thursday, September 8, 2016
  • by softbread
  • Repository
  • 1 Watchers
  • 0 Stars
  • 53 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

alidayu-php-sdk

This is a PHP SDK for Ali Dayu based on Guzzle 6., (*1)

This project is inspired by another PHP curl reversion for Ali Dayu -- https://github.com/Verytops/alisms, (*2)

一个简单的阿里大于短信发送的PHP SDK。如果项目已经有composer, 安装使用就更简单了。 本SDK是因为本人看到 https://github.com/Verytops/alisms 项目而受到启发, 然后决定为composer重写。 写得很赶, 很多东西没有按正规的composer project来写, 欢迎pull 或者 fork, (*3)

1. Pre-Request

  • Composer
  • PHP5.5+

2. Install

composer require softbread/alidayu-php-sdk:dev-master, (*4)

3. Typical Usage

a. Use setters:

$sendSms = new Softbread\AlidayuSdk\AliSms;
$sendSms->setEnv(false); // use sandbox or not
$sendSms->setKey('api_key'); // set API key
$sendSms->setSecret('api_secret'); // set API secret
$sendSms->setSmsSign('sms_free_sign'); // set free sign in SMS content
$sendSms->setTemplateParams([
  'param1' => 'var1',
  'param2' => 'var2',
]); // set template params
$sendSms->setTemplate('template_id'); // set template ID
$sendSms->setSmsMobile('13000000000'); // set mobile number
$sendSms->send();

b. Use callable function for easier dependency injection

$sendSms = new Softbread\AlidayuSdk\AliSms([
    'env'    => false,
    'key'    => 'api_key',
    'secret' => 'api_secret',
]); // inject config as array

$sendSms->send(
    '13000000000',  // mobile number
    'sms_free_sign' , // free sign in SMS content
    'template_id',  // template ID
    [
      'param1' => 'var1',
      'param2' => 'var2',
    ]  // template params
);

4. To-do

  • Add Voice-Text message
  • Add unit tests
  • Improve exception detection and handling

The Versions

08/09 2016

dev-master

9999999-dev

Provides an implelmentation of Ali Dayu SMS SDK that uses Guzzle 6 and Composer

  Sources   Download

Apache License Version 2.0

The Requires

 

The Development Requires

08/09 2016

1.0.1

1.0.1.0

Provides an implelmentation of Ali Dayu SMS SDK that uses Guzzle 6 and Composer

  Sources   Download

Apache License Version 2.0

The Requires

 

The Development Requires

07/09 2016

1.0.0

1.0.0.0

Provides an implelmentation of Ali Dayu SMS SDK that uses Guzzle 6 and Composer

  Sources   Download

Apache License Version 2.0

The Requires

 

The Development Requires