MainSMS.ru site
Notice: This extension was created by me for my own usages. I just share my code, but you can improve this extension by fork, if you want. This extension only on GitHub.
PHP >= 5.3.0
cURL
Just follow some steps:
Copy mainsms
folder to protected/extensions
:
cp mainsms your-site-folder/protected/extensions
Add some lines to your protected/config/main.php
file:
// Application components
components => array(
...
'mainsms' => array(
'class' =>'ext.mainsms.MainSms'
'projectName' => 'Your app name',
'apiKey' => 'your secret api key',
// optional:
'useSsl' => false,
'testMode' => true,
),
...
)
After past steps you can use this extension!
Yii::app()->mainsms->api->messageSend(array('9122222222'), 'Hello!\nIt works!', 'Name of your sender');
// you can use shortcut instead of this long line:
Yii::app()->mainsms->send(array('9122222222'), 'Hello!\nIt works!', 'Name of your sender');
Yii::app()->mainsms->api->getBalance();
// or use shortcut:
Yii::app()->mainsms->balance();
All methods description you can find on MainSMS official PHP class page. Tip Just use
Yii::app()->mainsms->api->methodName();
to call other methods.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.