New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

hardywen/yimei

亿美短信
697
Install
composer require hardywen/yimei
Latest Version:5.0.1
PHP:>=5.5.9
Laravel:5
License:MIT
Last Updated:Sep 1, 2015
Links: GitHub  ·  Packagist
Maintainer: hardywen

###Install

1.将 'hardywen/yimei': 'dev-master' 加入composer.json文件

"require": {
	  "laravel/framework": "4.2.*",
	  "..."
	  "hardywen/yimei": "dev-master"
},

2.运行composer update 安装本组件

3.在app/config/app.php中加入以下配置

	'providers' => array(
	    '...',
	    'Hardywen\Yimei\YimeiServiceProvider',
	)
	
	
	'aliases' => array(
	    '...',
	    'Yimei'            => 'Hardywen\Yimei\Facades\YimeiFacade',
	)

###Config

4.运行下面这条命令

php artisan config:publish hardywen/yimei

5.运行上面命令后,可以在 app/config/packages/hardywen/yimei/config里配置支付宝的相关参数

###Usage

6.发送短信

$content = Yimei::getContent(); //可以传入 code 参数。将通过config里面的内容模板渲染出来。不传code参数则会自动生成6位随机数字
$msg = Yimei::sendSMS(['138xxxxxxxx','138xxxxxxxx'], $content);

7.新实例 第6点的使用是使用config.php的配置去发送的。如果想实时更新配置,重新生成一个新实例,则用以下方法:

	$config = [];//配置项,没有配置的会使用config.php中的配置。
	$yimei = Yimei::newInstance($config);
	$content = $yimei->getContent();
	$yimei->sendSMS([],$content);

8.新增方法,除了官方demo里的方法之外,多增加了一个获取剩余短信条数的方法 getMsgStock(); 就是整合一个原有的getBalance()和getEachFee()而已

Related Packages

valorin/random

Random is a simple helper package designed to make it easy to generate a range o...

423,305 234
php
cline/variable-keys

Laravel Blueprint macros for variable primary key and morph types

23,466 0
php
cline/struct

Lean, attribute-driven Laravel data objects with explicit validation and Eloquen...

18,346 0
php
cline/toggl

Advanced feature flag management with strategies, time bombs, and groups

12,635 0
php
cline/sequencer

Sequential migration and operation orchestration for Laravel

11,736 0
php

Version History

Version Released PHP Laravel License
5.0.1 >=5.5.9 5.1.* MIT