Skip to content

Latest commit

 

History

137 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📱 SMSGate PHP Client

Contributors Forks Stars Issues License Packagist Version

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 MessageBuilder for messages and SettingsBuilder for 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 HttpException error 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

🤝 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.

About

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

Topics

Resources

Stars

35 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages