Repolode
overtrue

overtrue/easy-sms

A PHP library that sends SMS through many Chinese and international providers with one unified API, supporting failover and gateway strategies.

Stars
3,334
Forks
565
Open issues
23
Last commit
last month

What is it?

Easy SMS is a PHP component for sending text messages through multiple SMS service providers using a single calling convention. Developers configure one or more gateways, such as Alibaba Cloud, Tencent Cloud, Huawei Cloud, Yunpian or Twilio, and call one send method regardless of which provider handles the message.

When several gateways are configured, the library tries them in order or with another strategy, so a failing provider can be bypassed automatically. Each send returns a per-gateway result array with status and provider response, and throws a dedicated exception when every gateway fails. Message content can be given as plain text, a template ID with variables, or a message class, and custom gateways can be registered with a closure.

The package requires PHP 8.4 or newer and Guzzle 7 or 8, and is installed with Composer.

Key features

  • 01Unified send API across dozens of Chinese and international SMS providers.
  • 02Multiple gateways with ordered or custom strategies and automatic failover.
  • 03Per-gateway result array and a dedicated exception when all gateways fail.
  • 04Supports plain content, template IDs with variables, and reusable message classes.
  • 05Custom gateways can be registered without modifying the library.

Use cases

  • Sending verification codes in a PHP web application with a fallback provider.
  • Switching SMS vendors without rewriting application code.
  • Sending template-based notifications through Alibaba Cloud or Tencent Cloud from a PHP backend.
  • Logging send results from multiple providers for monitoring.

Quick start

  1. 1

    Install the package with Composer

    composer require "overtrue/easy-sms"
  2. 2

    Create an EasySms instance with your gateway config and call send()

Things to know

  • Requires PHP 8.4 or newer.
  • Each SMS provider needs its own account and credentials, so you must sign up with the providers you use.
  • Guzzle 8 requires header option values to be strings, so non-string values in gateway config will throw an error.

Topics

#sms#php#messaging#notification#api-client#verification-code#php-sms#sms-client#sms-gateway

FAQ

What is easy-sms?
A PHP library that sends SMS through many Chinese and international providers with one unified API, supporting failover and gateway strategies. Easy SMS is a PHP component for sending text messages through multiple SMS service providers using a single calling convention. Developers configure one or more gateways, such as Alibaba Cloud, Tencent Cloud, Huawei Cloud, Yunpian or Twilio, and call one send method regardless of which provider handles the message.
Is easy-sms free to use? What license does it have?
easy-sms is open source under the MIT license. Check the license terms before using it in commercial products.
Is easy-sms still maintained?
Updated within 6 months. The last commit to easy-sms was on Oct 4, 2026.
What can I use easy-sms for?
Sending verification codes in a PHP web application with a fallback provider. Switching SMS vendors without rewriting application code. Sending template-based notifications through Alibaba Cloud or Tencent Cloud from a PHP backend. Logging send results from multiple providers for monitoring.
How do I install easy-sms?
Install the package with Composer: composer require "overtrue/easy-sms" Create an EasySms instance with your gateway config and call send()
Where can I get easy-sms?
The source code and installation instructions are on GitHub: https://github.com/overtrue/easy-sms

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects