Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/android-sms-gateway/client-php

A PHP client library for sending and managing SMS messages via the SMS Gateway for Android™ API.
https://github.com/android-sms-gateway/client-php

android-sms api-client communication http-client messaging php php-library php-sdk psr-18 rest-api sms sms-api sms-gateway

Last synced: 3 months ago
JSON representation

A PHP client library for sending and managing SMS messages via the SMS Gateway for Android™ API.

Awesome Lists containing this project

README

        

# SMS Gateway for Android™ PHP API Client

This is a PHP client library for interfacing with the [SMS Gateway for Android](https://sms.capcom.me) API.

## Requirements

- PHP 7.4 or higher
- A PSR-18 compatible HTTP client implementation

## Installation

You can install the package via composer:

```bash
composer require capcom6/android-sms-gateway
```

## Usage

Here is a simple example of how to send a message using the library:

```php
Send($message);
echo "Message sent with ID: " . $messageState->ID() . PHP_EOL;
} catch (Exception $e) {
echo "Error sending message: " . $e->getMessage() . PHP_EOL;
die(1);
}

try {
$messageState = $client->GetState($messageState->ID());
echo "Message state: " . $messageState->State() . PHP_EOL;
} catch (Exception $e) {
echo "Error getting message state: " . $e->getMessage() . PHP_EOL;
die(1);
}
```

## Client

The `Client` is used for sending SMS messages in plain text, but can also be used for sending encrypted messages by providing an `Encryptor`.

### Methods

The `Client` class has the following methods:

* `Send(Message $message)`: Send a new SMS message.
* `GetState(string $id)`: Retrieve the state of a previously sent message by its ID.

# Contributing

Contributions are welcome! Please submit a pull request or create an issue for anything you'd like to add or change.

# License

This library is open-sourced software licensed under the [Apache-2.0 license](LICENSE).