headzoo/nexmo 问题修复 & 功能扩展

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

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

headzoo/nexmo

最新稳定版本:v0.1.3.1

Composer 安装命令:

composer require headzoo/nexmo

包简介

Library for communicating with the Nexmo SMS API.

README 文档

README

Library for communicating with the Nexmo SMS API.

Build Status Latest Stable Version MIT License

Overview

Nexmo is an inexpensive provider of voice and text (SMS) services based in the UK. This library is used to communicate with their API for the purpose of sending text messages to mobile devices.

Installing via Composer

The recommended way to install headzoo/nexmo is through Composer.

# Install Composer
curl -sS https://getcomposer.org/installer | php

Add headzoo/nexmo to your composer.json:

"require": {
	"headzoo/nexmo": "dev-master"
}

Or run the Composer command to install the latest stable version of headzoo/nexmo:

composer require headzoo/nexmo

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

Usage

use Headzoo\Nexmo\Sms;
use Headzoo\Nexmo\Exception\Exception;


// Start by creating an instance of Sms. You must have a Nexmo API key and secret, which you can find
// on the Nexmo dashboard. https://dashboard.nexmo.com/private/dashboard
// You also provide the "from" number or name. Each text you sent with the Sms instance will be sent
// from that number.
$nexmo_api_key = "n3xm0rocks";
$nexmo_api_secret = "12ab34cd";
$from = "12015555555";
$sms = Sms::factory($nexmo_api_key, $nexmo_api_secret, $from);


// To send a text message you pass the number you are sending to, in international format, along with
// the message to send. A Response instance is returned from which you can gather the details of the
// sent message. Keep in mind Nexmo may break up your text into several messages depending on
// the size of the sent message, and the Response will contain multiple Message instances.
try {
	$to = "19295555555";
	$message = "Hello, World!";
	$response = $sms->text($to, $message);
	foreach($response as $message) {
		echo "Message ID: " . $message->getId();
		echo "Message price: " . $message->getPrice();
		echo "Remaining balance: " . $message->getBalance();
	}
} catch (Exception $e) {
	echo $e->getMessage();
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-28