SmsIntel PHP Api
, (*1)
, (*2)
Library provides common interface for making requests to both XML and JSON smsintel API., (*3)
Dependencies
Library requires CURL extension and PHP 5.5.9 or above., (*4)
Installation
Via Composer:, (*5)
composer require seregazhuk/smsintel-api
Quick Start
// You may need to amend this path to locate composer's autoloader
require('vendor/autoload.php');
use seregazhuk\SmsIntel\SmsIntel;
$sender = SmsIntel::create('login', 'password');
// send sms
$result = $sender->send('phoneNumber', 'From', 'Your message text');
Sending messages
To send message to one phone number:, (*6)
$result = $sender->send('phoneNumber', 'From', 'Your message text');
You can pass an array of phones:, (*7)
$phones = [
'79999999999'
'79999999991'
'79999999992'
];
$result = $sender->send($phones, 'From', 'Your message text');
Cancel sms by id:, (*8)
$result = $sender->cancel($smsId);
Request a source name:, (*9)
$result = $sender->requestSource('FromPHP');
Get contact info by phone number:, (*10)
$contact = $sender->getPhoneInfo('79999999999');
Get all contacts:, (*11)
$contacts = $sender->getContacts();
Contacts for specific group:, (*12)
$groupId = 1;
$contacts = $sender->getContacts($groupId);
Contacts by phone number:, (*13)
$phone = '79999999999';
$contacts = $sender->getContacts(null, $phone);
// or with group:
$groupId = 1;
$contacts = $sender->getContacts($groupId, $phone);
Create a new contact:, (*14)
$contactInfo = [
'idGroup' => 1 // required
'phone' => '79999999999' // required
'f' => 'Second Name',
'i' => 'First Name',
'o' => 'Middle Name',
'bday' => 'YYYY-mm-dd',
'sex' => 1 // 1 - male, 2 - female
];
$result = $sender->addContact($contactInfo);
Remove contact by phone number:, (*15)
$sender->removeContact('79999999999');
You can pass optionally group id:, (*16)
$groupId = 1;
$sender->removeContact('79999999999', $groupId);
Get all groups:, (*17)
$groups = $send->getGroups();
Get group by id or name:, (*18)
$groups = $sender->getGroups($groupId);
$groups = $sender->getGroups(null, $groupName);
Create a new group of contacts:, (*19)
$result = $sender->createGroup('NewGroup');
Edit group name by id:, (*20)
$result = $sender->editGroup($newName, $groupId);
Account
Get account info:, (*21)
$result = $sender->getAccountInfo();
Get balance:, (*22)
$result = $sender->getBalance();
Use discount coupon:, (*23)
$result = $sender->checkCoupon('couponCode');
Only check discount coupon:, (*24)
$result = $sender->checkCoupon('couponCode', false);
Reports
Get report for period by phone number:, (*25)
$result = $sender->getReportByNumber($dateFrom, $dateTo, '79999999999');
Get report for period and for all numbers:, (*26)
$result = $sender->getReportByNumber($dateFrom, $dateTo);
Get report by smsId:, (*27)
$result = $sender->getReportBySms($smsId);
Get report for period by source:, (*28)
$result = $sender->getReportBySource($dateFrom, $dateTo, 'FromPHP');
Get report for period for all sources:, (*29)
$result = $sender->getReportBySource($dateFrom, $dateTo);
How can I thank you?
Why not star the github repo? I'd love the attention!, (*30)
Thanks!, (*31)