PHPackages                             andileong/aliyun-sms - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. andileong/aliyun-sms

ActiveLibrary

andileong/aliyun-sms
====================

A send sms package for aliyun

04PHP

Since Nov 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/andiLeong/aliyunSms)[ Packagist](https://packagist.org/packages/andileong/aliyun-sms)[ RSS](/packages/andileong-aliyun-sms/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

A package that send sms api request to aliyun
---------------------------------------------

[](#a-package-that-send-sms-api-request-to-aliyun)

A Package that communicate with aliyun sms api to trigger send sms functionality it's TDD using phpunit , using guzzle under the hood for http client.

Installation
------------

[](#installation)

```
composer require andileong/aliyun-sms

```

Usage
-----

[](#usage)

\###send sms

```
use Andileong\AliyunSms\SendSms;

$accessKeyId = 'your aliyun access key id';
$accessKeySecret = 'your aliyun access key secret';

$sms= new SendSms($accessKeyId,$accessKeySecret);

$signature = 'your aliyun signature';
$template_code = 'your aliyun template_code';
$data = ['code' => 444578 , 'product' => 'aaaaaa'];
$phoneNumber = '111111111111';
$res = $sms->setData($signature, $template_code ,$data)
->send($phoneNumber)
->isSuccess();

```

above call will return boolean , if return false you get the error message like so

```
$sms->getErrorMsg();
// @see https://help.aliyun.com/document_detail/101414.html for more return data
```

### retrieve sms send history for a mobile number on a specific date

[](#retrieve-sms-send-history-for-a-mobile-number-on-a-specific-date)

```
use Andileong\AliyunSms\History;

$accessKeyId = 'your aliyun access key id';
$accessKeySecret = 'your aliyun access key secret';
$phoneNumber = '111111111111';

    $data = (new History($accessKeyId,$accessKeySecret))
        ->yesterday()
        ->onPage(1) //on which page
        ->perPage(11) //on each page should contains page size max:50
        ->fetch($phoneNumber);

    //you can get yesterday or today for specific phone number
    //using yesterday() or today()
    //if you want other than those 2 you can use setDate() like below

    $date = '20000101';
    $data = (new History($accessKeyId,$accessKeySecret))
        ->setDate($date)
        ->onPage(1) //on which page
        ->perPage(11) //on each page should contains page size max:50
        ->fetch($phoneNumber);

    //$date passed on above setDate() method must follow YYYYmmdd format

    //you can pass an optional biz argument for fetch method
    // it will check that one sms transaction
    // you can get that from bizid from sendsms api

    $data = (new History($accessKeyId,$accessKeySecret))
        ->yesterday()
        ->onPage(1) //on which page
        ->perPage(11) //on each page should contains page size max:50
        ->fetch($phoneNumber,'mybizid');

        // see https://help.aliyun.com/document_detail/102352.html for more return data

```

you will get all data return from aliyun if success if fails you will also get status code from aliyun

### check signature Validity

[](#check-signature-validity)

```
use Andileong\AliyunSms\CheckSignature;

$accessKeyId = 'your aliyun access key id';
$accessKeySecret = 'your aliyun access key secret';
$signature = '111111111111';

    $data = (new CheckSignature($this->accessKeyId,$this->accessKeySecret))
        ->check($signature);

    //it will check if you signature is valid or not
    // see https://help.aliyun.com/document_detail/121210.html for more return data
```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a0f0ba4a42af18b9506aaeb8a2f98c8e077623582abd14be9a78cf9096bdb2ae?d=identicon)[andiLeong](/maintainers/andiLeong)

### Embed Badge

![Health badge](/badges/andileong-aliyun-sms/health.svg)

```
[![Health](https://phpackages.com/badges/andileong-aliyun-sms/health.svg)](https://phpackages.com/packages/andileong-aliyun-sms)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
