ol-zamovshafu/devinotelecom-php

A PHP client library for Devinotelecom REST API

1.3.0 2018-11-16 18:12 UTC

This package is not auto-updated.

Last update: 2024-05-12 22:40:52 UTC


README

Latest Version on Packagist Software License

This package provides an easy to use Devinotelecom SMS service which can be used with both XML and Http apis.

Contents

Installation

You can install this package via composer:

composer require ol-zamovshafu/devinotelecom-php

Setting up the Devinotelecom service

You will need to register to devinotele.com to use this channel.

Usage

First, boot the Service with your desired client implementation.

  • HttpClient (This is actually a Rest-Like client but the vendor names their API that way.)
require __DIR__ . '/../vendor/autoload.php';

use Zamovshafu\Devinotelecom\Service;
use Zamovshafu\Devinotelecom\ShortMessageFactory;
use Zamovshafu\Devinotelecom\Http\Clients\HttpClient;

$service = new Service(new HttpClient(
    new GuzzleHttp\Client(),
    'https://integrationapi.net/rest/',
    'username',
    'password',
    'outboxname'
), new ShortMessageFactory());

Available methods

After successfully booting your Service instance up; use one of the following methods to send SMS message(s).

One Message - Single or Multiple Recipients:

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

if($response->isSuccessful()) {
    // storeGroupIdForLaterReference is not included in the package.
    storeGroupIdForLaterReference($response->groupId());
} else {
    var_dump($response->message());
    var_dump($response->statusCode());
    var_dump($response->status());
}

Cross Reference

$response->groupId() will throw BadMethodCallException if the client is HttpClient.

change client implementation with caution.

Testing

$ composer test

Security

If you discover any security related issues, please email erdemkeren@gmail.com instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

Copyright (c) Hilmi Erdem KEREN erdemkeren@gmail.com

The MIT License (MIT). Please see License File for more information.