定制 connect-corp/nexmo-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

connect-corp/nexmo-client

Composer 安装命令:

composer require connect-corp/nexmo-client

包简介

Unofficial Nexmo Rest Client

README 文档

README

Unofficial Nexmo Rest Client

Documentation

Nexmo API Documentation

How to Install

$ composer require connect-corp/nexmo-client

Usage examples

Setting up the client object

    $apiKey = 'api_key_from_nexmo_account';
    $apiSecret = 'api_secret_from_nexmo_account';
    $nexmo = new \Nexmo\Client($apiKey, $apiSecret);

Sending a message

	$from = '1234567890';
	$to = '15551232020';
	$text = 'hello world';
    try {
        $response = $nexmo->message->invoke($from, $to, 'text', $text);
    } catch (Exception $e) {
        die($e->getMessage());
    }
    foreach ($response['messages'] as $i => $m) {
        switch ($m['status']) {
        case '0':
            echo 'Message sent successfully:';
			print_r($m);
            break;

        default:
            echo 'Message sending failed:'
			print_r($m);
            break;
        }
    }

Getting account balance

	try {
	    $response = $nexmo->account->balance();
	} catch (Exception $e) {
        die($e->getMessage());
	}
	echo "Account balance is $response";

Getting pricing by destination country

	$country = 'US';
	try {
        $response = $nexmo->account->pricing->country($country);
	} catch (Exception $e) {
        die($e->getMessage());
	}
	echo 'Price is ' . $response->price();

Getting pricing by recipient number

	$number = '15551232020';
	try {
		// SMS pricing.
        $response = $nexmo->account->pricing->sms($number);
		// Voice pricing.
        $response = $nexmo->account->pricing->voice($number);
	} catch (Exception $e) {
        die($e->getMessage());
	}
	echo 'Price is ' . $response->price();

Search for long virtual numbers by country

	$country = 'US';
	try {
        $response = $nexmo->number->search($country);
	} catch (Exception $e) {
        die($e->getMessage());
	}
    $all = $response->all();
	if (isset($all['numbers'])) {
		foreach	($all['numbers'] as $n) {
            printf("%d  \$%01.2f  %-10s  %-15s\n", $n['msisdn'], $n['cost'], $n['type'], join(',', $n['features']));
		}
	}

Buy a long virtual number

	$country = 'US';
	$msisdn = '1234567890'; // Number found using $nexmo->number->search()
	try {
        $response = $nexmo->number->buy($country, $msisdn);
	} catch (Exception $e) {
        die($e->getMessage());
	}
	if (200 == $response['error-code']) {
		echo 'Number purchase success';
	}

List long virtual numbers in your account

	$country = 'US';
	try {
        $response = $nexmo->account->numbers();
	} catch (Exception $e) {
        die($e->getMessage());
	}
    $all = $response->all();
	if (isset($all['numbers'])) {
		foreach	($all['numbers'] as $n) {
            printf("%d  %-2s  %-10s  %-15s\n", $n['msisdn'], $n['country'], $n['type'], join(',', $n['features']));
		}
	}

Cancel a long virtual number

	$country = 'US';
	$msisdn = '1234567890'; // Number found using $nexmo->account->numbers()
	try {
        $response = $nexmo->number->cancel($country, $msisdn);
	} catch (Exception $e) {
        die($e->getMessage());
	}
	if (200 == $response['error-code']) {
		echo 'Number cancel success';
	}

Contributors

https://github.com/ConnectCorp/nexmo-client/network/members

connect-corp/nexmo-client 适用场景与选型建议

connect-corp/nexmo-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 225.83k 次下载、GitHub Stars 达 15, 最近一次更新时间为 2015 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「sdk」 「nexmo」 「lib」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 connect-corp/nexmo-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 connect-corp/nexmo-client 我们能提供哪些服务?
定制开发 / 二次开发

基于 connect-corp/nexmo-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 225.83k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 16
  • 点击次数: 23
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 15
  • Forks: 12
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-26