承接 phpbook/sms 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

phpbook/sms

Composer 安装命令:

composer require phpbook/sms

包简介

PHP SMS Library For NEXMO, PLIVO, TWILIO

README 文档

README

About SMS

  • A lightweight SMS PHP library available for NEXMO, PLIVO e TWILIO.

Composer Install

composer require phpbook/sms

Declare Configurations

/********************************************
 * 
 *  Declare Configurations
 * 
 * ******************************************/

//Driver connection NEXMO

\PHPBook\SMS\Configuration\SMS::setConnection('main',
	(new \PHPBook\SMS\Configuration\Connection)
		->setName('Main')
		->setExceptionCatcher(function(String $message) {
			//the PHPBook SMS does not throw exceptions, but you can take it here
			//you can store $message in database or something else
		})
		->setDriver((new \PHPBook\SMS\Driver\NEXMO)
			->setKey('key')
			->setSecret('secret')
			->setFrom('00000000000'))
);

//Driver connection PLIVO

\PHPBook\SMS\Configuration\SMS::setConnection('notify',
	(new \PHPBook\SMS\Configuration\Connection)
		->setName('Notify')
		->setExceptionCatcher(function(String $message) {
			//the PHPBook SMS does not throw exceptions, but you can take it here
			//you can store $message in database or something else
		})
		->setDriver((new \PHPBook\SMS\Driver\PLIVO)
			->setKey('key')
			->setToken('token')
			->setFrom('00000000000'))
);

//Driver connection TWILIO

\PHPBook\SMS\Configuration\SMS::setConnection('payments', 
	(new \PHPBook\SMS\Configuration\Connection)
		->setName('Payments')
		->setExceptionCatcher(function(String $message) {
			//the PHPBook SMS does not throw exceptions, but you can take it here
			//you can store $message in database or something else
		})
		->setDriver((new \PHPBook\SMS\Driver\TWILIO)
			->setKey('key')
			->setToken('token')
			->setFrom('00000000000'))
);


//Set default connection by connection code

\PHPBook\SMS\Configuration\SMS::setDefault('main');

//Getting connections

$connections = \PHPBook\SMS\Configuration\SMS::getConnections();

foreach($connections as $code => $connection) {

	$connection->getName(); 

	$connection->getDriver();

};

?>

Sending SMS

		
	//Connection code is not required if you set default connection

	//make sure the number contain the country code with plus and are code too.

	$boolean = (new \PHPBook\SMS\SMS)
		->setConnectionCode('notify')
		->setMessage(
			(new \PHPBook\SMS\Message)
			->setTo(['+5547999999999', '+5547888888888'])
			->setContent('Hi Jhon')
		)
		->dispatch();

	if ($boolean) {
		//sent
	};

		

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固