Componette

Componette

BulkGate

BulkGate / php-sdk 1.0.1

๐Ÿ’Œ Simple PHP SDK for sending SMS/Viber via BulkGate portal.

download-cloud-line composer require bulkgate/php-sdk

BulkGate SMS/Viber - PHP SDK

PHP Downloads Latest Stable Version License Tests

Installation

The easiest way to install bulkgate/php-sdk into a project is by using Composer via the command line.

composer require bulkgate/php-sdk

Quick start

Nette DI Extension

extensions:
	sdk: BulkGate\Sdk\DI\Extension

sdk:
	application_id: 0000
	application_token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
	sender:
		tag: 'sdk' # Optional
		default_country: cz # Optional
	configurator:
		sms: # Optional
			sender_id: gText
			sender_id_value: 'Example'
			unicode: true
		viber: # Optional
			sender: Sender
			button:
				caption: 'Button Caption'
				url: 'https://www.bulkgate.com/'
			image: 
				url: 'https://www.example.com/example.png'
				zoom: true
			expiration: 3600 # seconds
use BulkGate\Sdk\Sender;
use BulkGate\Sdk\Message\Sms;

class Sdk
{
    private Sender $sender;

    public funnction __construct(Sender $sender)
    {
        $this->sender = $sender;
    }
    

    public function sendMessage(string $phone_number, string $text): void
    {    
        $this->sender->send(new Sms($phone_number, $text));
    }
}

Manual creation

use BulkGate\Sdk\Connection\ConnectionStream;
use BulkGate\Sdk\MessageSender;
use BulkGate\Sdk\Message\Sms;

$connection = new ConnectionStream(
    /*application_id: */ 0000, 
    /*application_token:*/ 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
);

$sender = new MessageSender($connection);

$sender->send(new Sms($phone_number, $text));

/* Optional */

$sender->setTag('sdk');

$sender->setDefaultCountry('cz');

$viber_configurator = new ViberConfigurator('Sender');
$viber_configurator->button('Button Caption', 'https://www.bulkgate.com/');
$viber_configurator->image('https://www.example.com/example.png', true);
$viber_configurator->expiration(3_600);

$sender->addSenderConfigurator($viber_configurator);

$sms_configurator = new SmsConfigurator('gText', 'Example', true);

$sender->addSenderConfigurator($sms_configurator);

$sender->send(new Sms($phone_number, $text));

Simple Manual

API administration & tokens

API administration

API token

  • 1.0.1 Credit Checker

    • Scheduled messages fix
    • CreditChecker #2
    • Improved generics

    Full Changelog: 1.0.0...1.0.1

  • 1.0.0 New BulkGate PHP SDK

bar-chart-fill

Statistics

download-cloud-fill
46408
star-fill
3
bug-fill
0
flashlight-fill
1.3y
price-tag-2-line

Badges

guide-fill

Dependencies

php (>=7.4)
ext-json (*)
ext-zlib (*)
ext-mbstring (*)
Componette Componette felix@nette.org