PHP code example of bahricanli / netgsm-php

1. Go to this page and download the library: Download bahricanli/netgsm-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bahricanli / netgsm-php example snippets




use BahriCanli\Netgsm\NetgsmService;
use BahriCanli\Netgsm\NetgsmService;
use BahriCanli\Netgsm\ShortMessageFactory;
use BahriCanli\Netgsm\Http\Clients\NetgsmXmlClient;
use BahriCanli\Netgsm\Http\Clients\NetgsmHttpClient;
use BahriCanli\Netgsm\ShortMessageCollectionFactory;

$service = new NetgsmService(new NetgsmXmlClient(
    'sms.Netgsm.net/xml',
    'username',
    'password',
    'outboxname'
), new ShortMessageFactory(), new ShortMessageCollectionFactory());

// ya da

$service = new NetgsmService(new NetgsmHttpClient(
    new GuzzleHttp\Client(),
    'https://sms.Netgsm.net/http',
    'username',
    'password',
    'outboxname'
), new ShortMessageFactory(), new ShortMessageCollectionFactory());

$response = $service->sendShortMessage(['5530000000', '5420000000'], 'This is a test message.');

if($response->isSuccessful()) {
    // storeGroupIdForLaterReference is not );
}

$response2 = $service->sendShortMessages([[
    'recipient' => '5530000000',
    'message' => 'This is a test.',
], [
    'recipient' => '5420000000',
    'message' => 'This is another test.',
]]);

if($response2->isSuccessful()) {
    // storeGroupIdForLaterReference is not 
 bash
composer