netsplit / textlocal
A generic Textlocal SMS library
1.1.1
2018-07-05 11:26 UTC
Requires
- php: ~5.6|~7.0
- curl/curl: ^1.5
Requires (Dev)
- phpunit/phpunit: >=5.4.3
- squizlabs/php_codesniffer: ^2.3
This package is not auto-updated.
Last update: 2025-04-04 23:55:31 UTC
README
Install
Via Composer
$ composer require netsplit/textlocal
Usage
$textlocal = new Netsplit\Textlocal(
'https://path.to.textlocal.com/api2',
'api-key-here'
);
Send an SMS message
API documentation for the "send" endpoint.
$response = $textlocal->sendSMS('Message content', [
// Array of mobile numbers
'07777777777',
'07777777778',
], [
// Optional values
'containsTrackingLinks' => false, // Should URLs in the SMS be minified?
'custom' => 'Any string', // For use as a reference
'groupID' => 5, // A Textlocal group ID
'receiptURL' => 'http://[...]', // Custom receipt URL
'scheduleAt' => 1530735900, // Unix timestamp - send the SMS at this time
'sender' => 'Optional Sender Name',
'sendToOptOut' => false, // Should the SMS be sent to users who have opted out?
'simpleReply' => false, // Disregard sender
'test' => true, // Don't really send the SMS
'unicode' => false, // Does the SMS contain unicode characters?
'validUntil' => 1530735994, // Unix timestamp - disregard the SMS at this time
]);
// Access values from the response:
echo $response->getStatus()->__toString(); // Hopefully "success"!
echo $response->getBalance()->getValue();
Shorten a URL
API documentation for the "short URL" endpoint
$response = $textlocal->getShortURL('https://www.google.com');
$shortURL = $response->getShortURL()->__toString();
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [redacted] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.