Download the PHP package pralhadstha/sms-gateways without Composer
On this page you can find all versions of the php package pralhadstha/sms-gateways. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pralhadstha/sms-gateways
More information about pralhadstha/sms-gateways
Files in pralhadstha/sms-gateways
Package sms-gateways
Short Description Framework-agnostic PHP SMS gateway with pluggable providers (Sparrow SMS and more).
License MIT
Informations about the package sms-gateways
SMS Gateway
A small, framework-agnostic PHP library for sending SMS through pluggable providers. No framework, no hard HTTP dependency — providers talk to any PSR-18 HTTP client, so it drops into Laravel, Symfony, or plain PHP alike.
Requirements
- PHP 8.1+
- A PSR-18 HTTP client and PSR-17 factories (e.g.
guzzlehttp/guzzle+nyholm/psr7, orsymfony/http-client) — only for HTTP-based providers.
Installation
For an HTTP provider you also need a client and factories, for example:
Usage
Every provider implements Pralhadstha\Sms\SmsGateway:
Sparrow SMS (Nepal)
Disabling / testing
Pralhadstha\Sms\Gateway\NullGateway— accepts every message and reports success without sending. Use it when no credentials are configured.Pralhadstha\Sms\Gateway\ArrayGateway— records messages in memory so your application's tests can assert on what would have been sent:
Error handling
send() returns an SmsResult:
- Provider rejection (non-2xx, error in body) →
SmsResult::failed()istrue; read->errorand->raw. - Transport failure (DNS, timeout, connection) → throws
Pralhadstha\Sms\Exception\SmsException.
Adding a provider
Implement SmsGateway and return an SmsResult. HTTP providers should accept
PSR-18/PSR-17 abstractions in the constructor — see
SparrowGateway as the reference.
Development
License
MIT — see LICENSE.
All versions of sms-gateways with dependencies
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0