Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atymic/sms-broadcast-php
PHP client for the SMS Broadcast API
https://github.com/atymic/sms-broadcast-php
australia sms sms-api sms-broadcast sms-gateway sms-sdk sms-service
Last synced: about 2 months ago
JSON representation
PHP client for the SMS Broadcast API
- Host: GitHub
- URL: https://github.com/atymic/sms-broadcast-php
- Owner: atymic
- Created: 2019-06-06T01:25:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-07-15T05:15:18.000Z (over 5 years ago)
- Last Synced: 2024-10-11T09:45:03.992Z (2 months ago)
- Topics: australia, sms, sms-api, sms-broadcast, sms-gateway, sms-sdk, sms-service
- Language: PHP
- Size: 31.3 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SmsBroadcast PHP API Client
[![Build Status](https://travis-ci.org/atymic/sms-broadcast-php.svg?branch=master)](https://travis-ci.org/atymic/sms-broadcast-php) [![StyleCI](https://github.styleci.io/repos/190493163/shield?branch=master)](https://github.styleci.io/repos/190493163) [![Latest Stable Version](https://poser.pugx.org/atymic/sms-broadcast/v/stable)](https://packagist.org/packages/atymic/sms-broadcast) [![License](https://poser.pugx.org/atymic/sms-broadcast/license)](https://packagist.org/packages/atymic/sms-broadcast)This is a simple API client for [SMS Broadcast](https://www.smsbroadcast.com.au/).
You can view their API documentation [here](https://www.smsbroadcast.com.au/Advanced%20HTTP%20API.pdf).
## Install
```bash
composer require atymic/sms-broadcast
```## Usage
### Creating the client
```php
$client = \Atymic\SmsBroadcast\Factory\ClientFactory::create(
'username',
'password',
'0412345678' // Default sender, optional
);
```### Sending a message to a single recipient
```php
try {
$response = $client->send('0487654321', 'This is an sms message');
} catch (\Atymic\SmsBroadcast\Exception\SmsBroadcastException $e) {
echo 'Failed to send with error: ' . $e->getMessage();
}echo 'SMS sent, ref: ' . $response->getSmsRef();
```### Sending a message to a multiple recipients
```php
$to = ['0487654321', '0487654322', '0487654323']
$responses = $client->sendMultiple($to, 'This is an sms message');foreach ($responses as $response) {
echo $response->hasError()
? 'Failed to send SMS: ' . $response->getError()
: 'SMS sent, ref: ' . $response->getSmsRef();
}
```### Check SMS credit balance
```php
echo $client->getBalance(); // int(1222)
```## Tests
By default only unit tests will run. If you want to run the integration tests, copy the `phpunit.dist.xml` file to `phpunit.xml` and supply your SMS Broadcast credentials & to number in the file.WARNING - Integration tests will send real SMS messages, so make sure not to run them in CI.
```bash
composer test
```# Todo
- Support for incoming message webhooks