1. 云栖社区>
  2. PHP教程>
  3. 正文

[Extension] yii2-sms

作者:用户 来源:互联网 时间:2017-12-01 10:46:08

[Extension] yii2-sms - 摘要: 本文讲的是[Extension] yii2-sms, Yii2-Sms Yii2-Sms sends free messages using Swift Mail Documentation Installation¶ This document will guide you throug

Yii2-Sms

[Extension] yii2-sms[Extension] yii2-sms

Yii2-Sms sends free messages using Swift Mail

Documentation

Installation¶

This document will guide you through the process of installing Yii2-Sms usingcomposer. Installation is a quick and easy two-step process.

Step 1: Download using composer

Add Yii2-Sms to the require section of yourcomposer.jsonfile:

{"require": {"abhi1693/yii2-sms": "1.0.0"}}

And run following command to download extension usingcomposer:

$ php composer.phar update

Step 2: Configure your application

$config = [	...	'components' => [		...		'sms' => [			'class'			 => 'abhimanyu/sms/components/Sms' // Class (Required)			'transportType'	 => 'smtp'						 // smtp/php (Optional)			'transportOptions'=> [							// (Required)				'host'	 => 'smtp.gmail.com'				// Other domains can also be used				'username' => '[email protected]',				'password' => '******',				'port'	 => '465',				'encryption' => 'ssl'			]		]	]]

Basic Usage¶

Valid Carriers

  • AT&T
  • Boost Mobile
  • Cingular
  • Metro PCS
  • Nextel
  • Sprint
  • T-Mobile
  • Verizon
  • Virgin Mobile

Usage

$sms = new Sms(); $carrier = "T-Mobile";$number = "0123456789";$subject = "Subject";$message = "Message";$sms->send($carrier, $number, $subject, $message);

以上是云栖社区小编为您精心准备的的内容,在云栖社区的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索,以便于您获取更多的相关知识。