Download the PHP package timefrontiers/php-sms without Composer
On this page you can find all versions of the php package timefrontiers/php-sms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download timefrontiers/php-sms
More information about timefrontiers/php-sms
Files in timefrontiers/php-sms
Package php-sms
Short Description Multi-driver SMS messaging for PHP 8.4+. Handles outbound sends, delivery webhooks, message logging, and driver‑based routing with automatic continent selection.
License proprietary
Informations about the package php-sms
timefrontiers/php-sms
Multi‑driver SMS messaging for PHP 8.4+. Handles outbound sends, delivery webhooks, message logging, and driver‑based routing with automatic continent selection.
Requirements
- PHP 8.4+
- MariaDB 10.4+ / MySQL 8.0+
timefrontiers/php-core— phone number country / continent detectiontimefrontiers/php-data— random code generationtimefrontiers/php-sql-databasetimefrontiers/php-database-objecttimefrontiers/php-paginationtimefrontiers/php-instance-errortimefrontiers/php-validatortwilio/sdk— required when using the Twilio driverafricastalking/africastalking— required when using the AfricasTalking driver
Installation
Database
Run sql/install.sql against your messaging database (e.g. messaging) to create the sms table.
Migrating from linktude/php-sms? See sql/migrate.sql.
Configuration
Call Sms::configure() once in your application bootstrap, before any SMS message is sent.
You can override any driver setting at send time.
Usage
Sending an SMS
send() returns a Sms instance (with status = 'sent') on success, or false on failure. Errors are accessible via the HasErrors trait (_userError, _systemError). Read them with InstanceError (rank‑filtered).
You may also call sendAndWait() — an alias that keeps API symmetry for future async support.
Override defaults per message
If driver is not supplied, the package resolves the driver according to region_strategy:
'auto'— determines the phone number’s continent viatimefrontiers/php-coreand picks the driver fromcontinent_mapping, falling back todefault_driver.- Any string — uses that driver directly.
Message lookups
Delivery reports (webhooks)
Handle incoming status callbacks from Twilio or AfricasTalking with a single static call:
- The driver verifies the webhook signature (
verifyDeliveryReport). - The payload is parsed into a normalized reference and status (
parseDeliveryReport). - The corresponding
smsrow is loaded and its status updated. - Driver‑specific metadata is merged into the
metaJSON column. - Returns the updated
Smsinstance ornullif verification fails.
If you need a fully custom delivery endpoint, you can instantiate a driver directly and call its verifyDeliveryReport / parseDeliveryReport methods.
Message entity
The Sms class represents a single row in the sms table and uses DatabaseObject + Pagination + HasErrors.
Public getters
| Method | Returns | Description |
|---|---|---|
id() |
?int |
Auto‑increment primary key |
code() |
?string |
828-prefixed 15‑char unique code |
status() |
string |
pending, queued, sent, failed, delivered |
messageId() |
?int |
Parent message ID (for reply chains) |
direction() |
string |
outbound or inbound |
user() |
string |
Owner code (default 'SYSTEM') |
batch() |
?string |
Batch group code |
sender() |
string |
Sender ID / phone used |
receiver() |
string |
Recipient phone number |
message() |
string |
Message body (max 250 chars) |
messagePages() |
int |
Calculated message parts (1‑5) |
fees() |
float |
Cost incurred |
feesCurrency() |
?string |
Currency of the fee |
reference() |
?string |
Provider‑assigned ID |
meta() |
?array |
Driver‑specific metadata (decoded JSON) |
Pagination
The Pagination trait is available:
Query Builder
Custom drivers
Implement TimeFrontiers\Sms\Driver\SmsDriverInterface:
Register it in configuration:
Then pass 'driver' => 'mydriver' when sending.
Error handling
- The
Smsclass uses theHasErrorstrait. Validation failures and driver errors are recorded as_userError(rank 0) or_systemError(rank 7). -
To read errors filtered by access rank, wrap the instance in
InstanceError: - Exceptions are thrown only for truly exceptional conditions (missing configuration, unknown driver). Normal send failures return
falseand populate errors.
Database migration
If you are upgrading from linktude/php-sms:
- Run
sql/migrate.sqlto update the schema. - Then call
Sms::populateMissingCodes($conn)to fill the newcodecolumn with unique828‑prefixed identifiers.
License
MIT
All versions of php-sms with dependencies
timefrontiers/php-core Version ^1.0
timefrontiers/php-data Version ^1.0
timefrontiers/php-sql-database Version ^1.0
timefrontiers/php-database-object Version ^1.0
timefrontiers/php-pagination Version ^1.0
timefrontiers/php-instance-error Version ^1.0
timefrontiers/php-validator Version ^1.0
twilio/sdk Version ^8.0
africastalking/africastalking Version ^3.0