https://github.com/developifynet/sms4connect-php
SMS 4 Connect SMS API PHP Wrapper
https://github.com/developifynet/sms4connect-php
Last synced: 8 months ago
JSON representation
SMS 4 Connect SMS API PHP Wrapper
- Host: GitHub
- URL: https://github.com/developifynet/sms4connect-php
- Owner: developifynet
- License: mit
- Created: 2020-04-21T11:30:21.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-21T17:18:31.000Z (about 6 years ago)
- Last Synced: 2025-03-15T21:33:31.052Z (about 1 year ago)
- Language: PHP
- Size: 20.5 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SMS 4 Connect SMS API Wrapper for PHP
This composer package offers a quick SMS setup for your php or Laravel applications.
## Installation
Begin by pulling in the package through Composer.
```bash
composer require developifynet/sms4connect-php
```
## Laravel Framework Usage
Within your controllers, you can call Sms4Connect facade and can send quick SMS.
#### Send SMS
##### Send SMS for Single Number
```php
use Developifynet\Sms4Connect\Sms4Connect;
public function index()
{
$SMSObj = array(
'id' => '', // Use your account id here
'password' => '', // Use your account password here
'to' => '923XXXXXXXXX', // You can provide single number as string or an array of numbers
'msg' => '', // Message string you want to send to provided number(s)
'mask' => '', // Use a registered mask with SMS 4 Connect
'test_mode' => '0', // 0 for Production, 1 for Mocking as Test
);
$response = Sms4Connect::SendSMS($SMSObj);
}
```
##### Send SMS for Multiple Number
```php
use Developifynet\Sms4Connect\Sms4Connect;
public function index()
{
$SMSObj = array(
'id' => '', // Use your account id here
'password' => '', // Use your account password here
'to' => ['923XXXXXXXXX', '923XXXXXXXXX'],, // You can provide single number as string or an array of numbers
'msg' => '', // Message string you want to send to provided number(s)
'mask' => '', // Use a registered mask with SMS 4 Connect
'test_mode' => '0', // 0 for Production, 1 for Mocking as Test
);
$response = Sms4Connect::SendSMS($SMSObj);
}
```
#### Check Delivery Status
##### Check Status for Single Transaction
```php
use Developifynet\Sms4Connect\Sms4Connect;
public function index()
{
$SMSObj = array(
'id' => '', // Use your account id here
'password' => '', // Use your account password here
'transaction' => 'XXXXXXXXX', // You can provide single sms transaction id as string or an array of numbers
'test_mode' => '0', // 0 for Production, 1 for Mocking as Test
);
$sms4connect = new Sms4ConnectSMS::checkDeliveryStatus($SMSObj);
}
```
##### Check Status for Multiple Transaction
```php
use Developifynet\Sms4Connect\Sms4Connect;
public function index()
{
$SMSObj = array(
'id' => '', // Use your account id here
'password' => '', // Use your account password here
'transaction' => ['XXXXXXXXX', 'XXXXXXXXX'], // You can provide single sms transaction id as string or an array of numbers
'test_mode' => '0', // 0 for Production, 1 for Mocking as Test
);
$sms4connect = new Sms4ConnectSMS::checkDeliveryStatus($SMSObj);
}
```
#### Check Account Balance
```php
use Developifynet\Sms4Connect\Sms4Connect;
public function index()
{
$SMSObj = array(
'id' => '', // Use your account id here
'password' => '', // Use your account password here
'test_mode' => '0', // 0 for Production, 1 for Mocking as Test
);
$sms4connect = new Sms4ConnectSMS::checkBalance($SMSObj);
}
```
## Other Usage
Within your controllers, you can call Sms4ConnectSMS Object and can send quick SMS.
#### Send SMS
##### Send SMS for Single Number
```php
use \Developifynet\Sms4Connect\Sms4ConnectSMS;
public function index()
{
$SMSObj = array(
'id' => '', // Use your account id here
'password' => '', // Use your account password here
'to' => '923XXXXXXXXX', // You can provide single number as string or an array of numbers
'msg' => '', // Message string you want to send to provided number(s)
'mask' => '', // Use a registered mask with SMS 4 Connect
'test_mode' => '0', // 0 for Production, 1 for Mocking as Test
);
$sms4connect = new Sms4ConnectSMS();
$response = $sms4connect->SendSMS($SMSObj);
}
```
##### Send SMS for Multiple Number
```php
use \Developifynet\Sms4Connect\Sms4ConnectSMS;
public function index()
{
$SMSObj = array(
'id' => '', // Use your account id here
'password' => '', // Use your account password here
'to' => ['923XXXXXXXXX', '923XXXXXXXXX'],, // You can provide single number as string or an array of numbers
'msg' => '', // Message string you want to send to provided number(s)
'mask' => '', // Use a registered mask with SMS 4 Connect
'test_mode' => '0', // 0 for Production, 1 for Mocking as Test
);
$sms4connect = new Sms4ConnectSMS();
$response = $sms4connect->SendSMS($SMSObj);
}
```
#### Check Delivery Status
##### Check Status for Single Transaction
```php
use \Developifynet\Sms4Connect\Sms4ConnectSMS;
public function index()
{
$SMSObj = array(
'id' => '', // Use your account id here
'password' => '', // Use your account password here
'transaction' => 'XXXXXXXXX', // You can provide single sms transaction id as string or an array of numbers
'test_mode' => '0', // 0 for Production, 1 for Mocking as Test
);
$sms4connect = new Sms4ConnectSMS();
$response = $sms4connect->checkDeliveryStatus($SMSObj);
}
```
##### Check Status for Multiple Transaction
```php
use \Developifynet\Sms4Connect\Sms4ConnectSMS;
public function index()
{
$SMSObj = array(
'id' => '', // Use your account id here
'password' => '', // Use your account password here
'transaction' => ['XXXXXXXXX', 'XXXXXXXXX'], // You can provide single sms transaction id as string or an array of numbers
'test_mode' => '0', // 0 for Production, 1 for Mocking as Test
);
$sms4connect = new Sms4ConnectSMS();
$response = $sms4connect->checkDeliveryStatus($SMSObj);
}
```
#### Check Account Balance
```php
use \Developifynet\Sms4Connect\Sms4ConnectSMS;
public function index()
{
$SMSObj = array(
'id' => '', // Use your account id here
'password' => '', // Use your account password here
'test_mode' => '0', // 0 for Production, 1 for Mocking as Test
);
$sms4connect = new Sms4ConnectSMS();
$response = $sms4connect->checkBalance($SMSObj);
}
```
### Note
Provided numbers should start with Country code. A Pakistani number you have to write down as 923XXXXXXXXX