SMS extension for Yii integration
Send SMS messages through the LabsMobile platform integrated with the Yii Framework. v1.0 and v2.0. Register and install the module and you will be able to send SMS messages in a matter of seconds.
Functionalities
- Basic SMS sending.
- Shipments by campaigns.
- Balance inquiry.
Requirements
- Yii v1.1 or v2.0. More information at yiiframework.com .
- A LabsMobile user account. Follow the link below to create a new account: Register.
Authentication
In the integration with Yii, authentication is performed with two parameters:
- The username of the account to be specified in the
LMaccount_username
parameter. - The tokenapi to be assigned in the
LMaccount_password
parameter. This tokenapi can be generated from the API Settings section of your account.
Recommendation You can generate API tokens from the API Settings of the account. We recommend changing the token frequently and using different tokens for each use, connection or integration.
Installation
- Copy the LabsMobileSMS directory into the /vendor directory.
LabsMobile Module
Click on the following link and download the LabsMobile SMS Module.
- Add the following lines to your configuration file (e.g., /config/web.php)
Yii Framework v1.1
Parameters
<?php 'components' => array( ... 'sms' => array( 'class'=>'ext.LabsMobileSms.LabsMobileSms', 'LMaccount_username'=>'{YOUR USERNAME}', 'LMaccount_password'=>'{YOUR PASSWORD}', 'LMaccount_clientapi'=>'{YOUR API CLIENT}', ), );
Yii Framework v2.0
Parameters
<?php 'components' => [ ... 'sms' => [ 'class' => 'app\vendor\LabsMobileSMS\LabsMobileSMS', 'LMaccount_username'=>'{YOUR USERNAME}', 'LMaccount_password'=>'{YOUR TOKEN}', 'LMaccount_clientapi'=>'{YOUR API CLIENT}', ],
- You can now send messages with the following code
Send SMS
<?php Yii::$app->sms->send(array('to'=>'14158141829', 'message'=>'Hello world!'));
- You can also check your account balance with the following code.
Balance inquiry
<?php Yii::$app->sms->get_balance();
- With these simple steps you can now use all the functionalities of the module.