benmorel / clickatell
Client library for the Clickatell SMS gateway
Fund package maintenance!
BenMorel
Installs: 12 238
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: >=5.5
- ext-mbstring: *
- guzzlehttp/guzzle: 6.*
This package is auto-updated.
Last update: 2024-10-21 01:38:13 UTC
README
A simple library to send SMS through the Clickatell SMS gateway.
Clickatell supports two character encodings: 7-bit (up to 160 characters per message) and Unicode (up to 70 characters per message). The choice of the encoding directly influences the number of credits debited when sending an SMS.
This library automatically handles character set conversion, using 7-bit whenever possible and switching to Unicode only when required. This guarantees a perfect delivery of the original message, while minimizing credit consumption.
Basic usage
$client = new Clickatell\ClickatellClient('api-id', 'username', 'password'); $client->authenticate(); $client->send('441234567890', 'Hello world');
The authenticate()
call is required once, whether you need to send()
one or several SMS messages.
The phone numbers must be in E.164 international format: country code + national number without 0
prefix.
They must not include a leading +
sign.
The message must use the UTF-8 charset.
Sender ID
If you registered a sender ID with Clickatell, you can specify it when instantiating the library:
$client = new Clickatell\ClickatellClient('api-id', 'username', 'password', 'sender-id');
It will then automatically be used for every send()
call. Alternatively, you can pass it to every call individually:
$client->send('441234567890', 'Hello world', 'sender-id');