A modern PHP client for the SMSGate API: send SMS messages and manage devices, webhooks, settings, and JWT tokens through your Android devices. PSR-18/PSR-17 compatible with any HTTP client via php-http/discovery. See the client libraries overview for the full ecosystem.
capcom6/android-sms-gateway is a type-safe PHP library for the SMSGate 3rd-party API. It covers messages (send, state, listing, cancellation), inbox refresh with attachment download, devices, webhooks, settings, logs, health checks, and the JWT token lifecycle, with a fluent MessageBuilder for message construction and an optional Encryptor for end-to-end encryption. Works with any PSR-18 HTTP client (Guzzle, curl, or others) and PHP 7.4+.
- Fluent
MessageBuilderfor messages andSettingsBuilderfor settings - PSR-18 HTTP client and PSR-17 factories, auto-discovered
- Basic and JWT authentication with token generation and revocation
- Webhooks, devices, settings, logs, and health checks
- Inbox refresh with webhook delivery and MMS attachment download
- Optional end-to-end encryption via
Encryptor - Structured
HttpExceptionerror handling
composer require capcom6/android-sms-gatewayRequires PHP 7.4+ and a PSR-18 HTTP client implementation (e.g. Guzzle, php-http/curl-client).
Two methods are supported: Basic authentication with account credentials, and JWT bearer tokens with scoped permissions. JWT is recommended for production.
// Basic authentication with account credentials
$client = new Client('your_login', 'your_password');use AndroidSmsGateway\Domain\TokenRequest;
$basicClient = new Client('your_login', 'your_password');
$token = $basicClient->GenerateToken(
new TokenRequest(['messages:send', 'messages:read'], 3600)
);
$jwtClient = new Client(null, $token->AccessToken());<?php
require 'vendor/autoload.php';
use AndroidSmsGateway\Client;
use AndroidSmsGateway\Domain\MessageBuilder;
$client = new Client('your_login', 'your_password');
$message = (new MessageBuilder('Hello from PHP', ['+15550100']))
->setWithDeliveryReport(true)
->build();
$state = $client->SendMessage($message);
echo 'Message ID: ' . $state->ID() . PHP_EOL;Beyond sending, the client covers message listing and cancellation, inbox listing and refresh, device management, health checks, logs, settings (get, patch, replace), webhooks, and token lifecycle. See src/Client.php for the complete method list with signatures and src/Domain for the domain models.
- Official API Reference - endpoints, payloads, and error codes
- Authentication Guide - scopes and token management
- Client libraries overview
- Client source - full method reference and examples
Contributions are welcome. Open an issue to discuss major changes before submitting a pull request; PRs target the master branch.
Distributed under the Apache License 2.0. See LICENSE.