PHPackages                             ender/yunpian-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. [HTTP &amp; Networking](/categories/http)
4. /
5. ender/yunpian-sms

ActiveLibrary[HTTP &amp; Networking](/categories/http)

ender/yunpian-sms
=================

A php SDK for yunpian(云片网络短信服务商) sms RESTFULL API

v1.0.3(10y ago)244.9k4MITPHPPHP &gt;=5.4.0

Since Jun 2Pushed 10y ago2 watchersCompare

[ Source](https://github.com/argb/yunpian-sms)[ Packagist](https://packagist.org/packages/ender/yunpian-sms)[ Docs](https://www.bigfeettrip.com)[ RSS](/packages/ender-yunpian-sms/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

云片网络短信发送PHP SDK
===============

[](#云片网络短信发送php-sdk)

**Note:** 依赖guzzlehttp/guzzle 6，安装本此包时会默认安装此依赖，可能很多其他的第三方库依赖较低版本的guzzle,如guzzle 5

这个SDK主要是对 **[云片网络](http://www.yunpian.com/api/howto.html)** 的HTTP短信发送相关API的PHP封装。

云片网络是目前比较靠谱的短信发送提供商，速度和价格都不错，由于自己项目中用到，顺便打了个包共享给大家。

Install
-------

[](#install)

Via Composer

```
$ composer require ender/yunpian-sms
```

Usage
-----

[](#usage)

如果单独使用别忘了引入composer生成的autoload.php文件

如果是laravel用户可以不用手动include

使用此sdk之前别忘了先在[云片网络官网](http://www.yunpian.com/)注册并申请相应的**apikey**

示例代码如下

#### 发送短信

[](#发送短信)

```
use Ender\YunPianSms\SMS\YunPianSms;
$yunpianSms=new YunPianSms('xxxxxxxxxxxxxxxxxx');
$response=$yunpianSms->sendMsg('18xxxxxxx51','【云片网】您的验证码是1234');
```

#### 获取当前账户余额等信息

[](#获取当前账户余额等信息)

```
use Ender\YunPianSms\SMS\YunPianUser;
$yunpianSms=new YunPianUser('xxxxxxxxxxxxxxxx');
$response=$yunpianSms->getAccountInfo();
```

构造函数参数即为你的个人的**apikey**

根据云片网络官方接口文档的分类，也对应的封装了三个Class:

- YunPianUser
- YunPianSms
- YunPianTemplate

分别对应 账户，模板，短信三部分功能，基本覆盖了所有接口。以下三个接口除外：

- 模板接口发短信（不推荐使用，新用户请用发短信） 这个接口官方不推荐，所以没有封装
- 推送状态报告 这是个推送接口，需要使用者提供url，故不作处理
- 推送回复短信 同样是个推送接口

**Note:** 注意部分接口是高级接口，需要申请才能使用，具体可查阅官方文档

各个接口与本SDK中方法的对应关系基本上可以从名字上猜出来，很直观，实在猜不出来进入到方法里面可以看到对应的官方http接口。

### 返回值说明

[](#返回值说明)

所有接口返回php数组格式，最外层包括http status code 和云片网络的完整返回值两部分，以短信发送接口sendMsg返回值为例，格式如下：

```
array (
  'status' => 200,
  'data' =>
  array (
    'code' => 0,
    'msg' => 'OK',
    'result' =>
    array (
      'count' => 1,
      'fee' => 1,
      'sid' => 1956790935,
    ),
  ),
)
```

data部分就是官方api的完整返回值，此处把json字符串转成了数组形式。

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email :author\_email instead of using the issue tracker.

Credits
-------

[](#credits)

- [:author\_name](https://github.com/:author_username)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor4

4 contributors hold 50%+ of commits

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.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

4003d ago

### Community

Maintainers

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

---

Top Contributors

[![philsturgeon](https://avatars.githubusercontent.com/u/67381?v=4)](https://github.com/philsturgeon "philsturgeon (20 commits)")[![RobLoach](https://avatars.githubusercontent.com/u/25086?v=4)](https://github.com/RobLoach "RobLoach (7 commits)")[![frankdejonge](https://avatars.githubusercontent.com/u/534693?v=4)](https://github.com/frankdejonge "frankdejonge (6 commits)")[![marcqualie](https://avatars.githubusercontent.com/u/101022?v=4)](https://github.com/marcqualie "marcqualie (4 commits)")[![ravage84](https://avatars.githubusercontent.com/u/625761?v=4)](https://github.com/ravage84 "ravage84 (3 commits)")[![reinink](https://avatars.githubusercontent.com/u/882133?v=4)](https://github.com/reinink "reinink (3 commits)")[![assertchris](https://avatars.githubusercontent.com/u/200609?v=4)](https://github.com/assertchris "assertchris (2 commits)")[![browner12](https://avatars.githubusercontent.com/u/5232313?v=4)](https://github.com/browner12 "browner12 (2 commits)")[![bcrowe](https://avatars.githubusercontent.com/u/752603?v=4)](https://github.com/bcrowe "bcrowe (2 commits)")[![kdubuc](https://avatars.githubusercontent.com/u/895661?v=4)](https://github.com/kdubuc "kdubuc (2 commits)")[![grrnikos](https://avatars.githubusercontent.com/u/3323561?v=4)](https://github.com/grrnikos "grrnikos (1 commits)")[![hassankhan](https://avatars.githubusercontent.com/u/1781985?v=4)](https://github.com/hassankhan "hassankhan (1 commits)")[![Jeroen-G](https://avatars.githubusercontent.com/u/1116853?v=4)](https://github.com/Jeroen-G "Jeroen-G (1 commits)")[![josevieirame](https://avatars.githubusercontent.com/u/1133889?v=4)](https://github.com/josevieirame "josevieirame (1 commits)")[![nyamsprod](https://avatars.githubusercontent.com/u/51073?v=4)](https://github.com/nyamsprod "nyamsprod (1 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (1 commits)")[![schmittjoh](https://avatars.githubusercontent.com/u/197017?v=4)](https://github.com/schmittjoh "schmittjoh (1 commits)")[![Anahkiasen](https://avatars.githubusercontent.com/u/1321596?v=4)](https://github.com/Anahkiasen "Anahkiasen (1 commits)")[![zackkitzmiller](https://avatars.githubusercontent.com/u/111536?v=4)](https://github.com/zackkitzmiller "zackkitzmiller (1 commits)")[![argb](https://avatars.githubusercontent.com/u/166504?v=4)](https://github.com/argb "argb (1 commits)")

---

Tags

phpsmsduanxin

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ender-yunpian-sms/health.svg)

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

###  Alternatives

[infobip/infobip-api-php-client

PHP library for consuming Infobip's API

921.8M10](/packages/infobip-infobip-api-php-client)[xeroapi/xero-php-oauth2

Xero official PHP SDK for oAuth2 generated with OpenAPI spec 3

1054.3M14](/packages/xeroapi-xero-php-oauth2)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.0k](/packages/ismaeltoe-osms)

PHPackages © 2026

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