Coder Social home page Coder Social logo

bulkgate / php-sdk Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 134 KB

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

Home Page: https://help.bulkgate.com/docs/en/php-sdk-installation-v2.html

License: BSD 3-Clause "New" or "Revised" License

PHP 100.00%
php sdk-php sdk viber sms viber-api sms-api bulkgate nette nette-extension nette-framework

php-sdk's Introduction

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

php-sdk's People

Contributors

lukaspijak avatar marekpijak avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

moynzzz

php-sdk's Issues

Option to check credits

Hello,
are there any plans to add option to check credits or will this be only available in HTTP api?

Sms is always sent via System number

I was upgrade deprecated Nette SDK to this library, but I have simple problem. All messages are sent as system number, even if all is set for Text Sender or Short Code. I tried to set it via Sms->configure(), Sms->settings->configure or MessageSender configurator, send message return type show me correctly that sender_id is gText, (sender_id_value has 11 characters), but in Portal and incoming SMS is only system number.
Also try to set a new API in Portal (PHP SDK) instead old Nette SDK, but nothing was changed.

So, until this will be fixed, I must turn back to old SDK, where everything was correct.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.