espressobyte/firemobile-php

Firemobile API Client for PHP

1.0.0 2021-12-22 06:44 UTC

This package is auto-updated.

Last update: 2024-11-18 02:00:31 UTC


README

StyleCI tests

This package is for sending SMS via Firemobile service providers.

Installation

You can install the package via composer:

composer require espressobyte/firemobile-php 

Usage without set option for delivery report callback

<?php 

use Firemobile\Client;
use Firemobile\FiremobileAuth;
use Firemobile\Message;
use Firemobile\Requests\Sms;
use GuzzleHttp\Client as HttpClient;

$message = Message::make()
    ->setFrom('+60123456789')
    ->setTo('+60123226789')
    ->setText('Firemobile message.');

$firemobile = Client::make(new HttpClient(),[
    'username' => 'secret',
    'password' => 'secret',
]);

$response = Sms::make($message,FiremobileAuth::make($firemobile))
->send();

echo $response->getStatusCode();
echo $response->getBody();

Usage with option for delivery report received

<?php 

use Firemobile\Client;
use Firemobile\FiremobileAuth;
use Firemobile\Message;
use Firemobile\Requests\Sms;
use GuzzleHttp\Client as HttpClient;

$callbackUrl = 'https://demo.test/callback';

$message = Message::make()
    ->setFrom('+60123456789')
    ->setTo('+60123226789')
    ->setText('Firemobile message.');

$firemobile = Client::make(new HttpClient(),[
    'endpoint' => 'https://firemobile.send.com:8000/cgi-bin',
    'username' => 'c2VjcmV0Cg==',
    'password' => 'c2VjcmV0Cg==',
])
->callback($callbackUrl);

$response = Sms::make($message,FiremobileAuth::make($firemobile))->send();

echo $response->getStatusCode();
echo $response->getBody();

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Security

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