PHP code example of larc / smpp-client-php

1. Go to this page and download the library: Download larc/smpp-client-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/ */

    

larc / smpp-client-php example snippets




use Larc\smpp\entities\{serverConfig, SMS, Bulk};
use Larc\smpp\{SMSBuilder, SMPP, Debug};

$config = new serverConfig();
$config->setHost('127.0.0.1');
$config->setPort('1234');
$config->setSystemId('12345');
$config->setPassword('54321');
$config->setCommandId(SMPP::BIND_TRANSCEIVER);
$config->setTon(SMPP::TON_ALPHANUMERIC);
$config->setNpi(SMPP::NPI_PRIVATE);

$sms = new SMS();
$sms->setSender('Example Sender');
$sms->setRecipient('50760001000');
$sms->setMessage('Este es un sms de prueba ondemand');
$sms->setFlash(false);
$sms->setUtf(false);

$SMSBuilder = new SMSBuilder($config, new Debug(false));
$res1 		= $SMSBuilder->send($sms);

$msisdn = [
	'50760001000',
	'50760002000'
];

$sms = new Bulk();
$sms->setSender('Example Sender');
$sms->setRecipient($msisdn);
$sms->setMessage('Este es un sms de prueba masivo');
$sms->setFlash(false);
$sms->setUtf(false);

$SMSBuilder = new SMSBuilder($config, new Debug(false));
$res2 		= $SMSBuilder->sendBulk($sms);

$sms->setFlash(true);
bash
composer