capcom6 / android-sms-gateway
Provides access to Android SMS Gateway API
Requires
- php: >=7.4
- php-http/discovery: ^1.17
- psr/http-client-implementation: ^1.0
Requires (Dev)
- laminas/laminas-diactoros: ^2.17
- php-http/curl-client: ^2.2
- php-http/message: ^1.0
- php-http/mock-client: ^1.0
- phpstan/phpstan: ^1.5 || ^2.0
- phpunit/phpunit: ^9.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-01 07:21:16 UTC
README
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.
📖 About
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+.
📚 Table of Contents
⭐ Features
- 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
📦 Installation
composer require capcom6/android-sms-gateway
Requires PHP 7.4+ and a PSR-18 HTTP client implementation (e.g. Guzzle, php-http/curl-client).
🔑 Authentication
Two methods are supported: Basic authentication with account credentials, and JWT bearer tokens with scoped permissions. JWT is recommended for production.
Basic Authentication
// Basic authentication with account credentials $client = new Client('your_login', 'your_password');
JWT Authentication
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());
🚀 Quickstart
<?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;
💻 Usage
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.
📖 API Reference
- Official API Reference - endpoints, payloads, and error codes
- Authentication Guide - scopes and token management
- Client libraries overview
- Client source - full method reference and examples
🤝 Contributing
Contributions are welcome. Open an issue to discuss major changes before submitting a pull request; PRs target the master branch.
📄 License
Distributed under the Apache License 2.0. See LICENSE.