Recommend this page to a friend! |
Download |
Info | Documentation | Demos | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 55 | All time: 10,597 This week: 49 |
Version | License | PHP version | Categories | |||
smsgateway 1.0.4 | GNU Lesser Genera... | 5.3 | Networking, PHP 5, Wireless and Mobile |
Description | Author | |
This package provides an API to send SMS messages using an Android gateway. |
SMS Messages to Email
Get SMS Messages
Send sms to friends
I have not queries
PHP form to send SMS to users
PHP form to send SMS to users
What is the best PHP email sms class?
Send SMS via email
Recommendation for a PHP class to send sms message
Send SMS with PHP
What is the best PHP sms sending class?
Sending SMS with a PC using a mobile phone
This software is distributed under the LGPL-3.0-only license. Please read LICENSE for information on the software availability and distribution.
SMSGateway is available on Packagist (using semantic versioning), and installation via Composer is the recommended way to install SMSGateway. Just add this line to your composer.json
file:
"multiotp/smsgateway": "^1.0"
or run
composer require multiotp/smsgateway
Note that the vendor
folder and the vendor/autoload.php
script are generated by Composer; they are not part of SMSGateway.
Alternatively, if you're not using Composer, you
can download SMSGateway as a zip file, then copy the contents of the SMSGateway folder into one of the include_path
directories specified in your PHP configuration and load each class file manually:
<?php
use multiOTP\SMSGateway\SMSGateway;
require 'path/to/SMSGateway/src/SMSGateway.php';
<?php
//Import SMSGateway classes into the global namespace
//These must be at the top of your script, not inside a function
use multiOTP\SMSGateway\SMSGateway;
//Load Composer's autoloader
require 'vendor/autoload.php';
//Create an instance
$smsgateway = new SMSGateway();
// Set the data folder
$smsgateway->setDataPath(__DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR);
// Set the shared secret
$smsgateway->setSharedSecret("secret");
$device_id = "demo";
$to = "+1234567890";
$message = "Demo message";
$device_h = $smsgateway->calculateAuthenticationHash($device_id);
$message_id = $smsgateway->sendMessage($device_id, $to, $message);
echo "Full URL for Android app URL: https://......./?id=$device_id&h=$device_h";
<?php
//Import SMSGateway classes into the global namespace
//These must be at the top of your script, not inside a function
use multiOTP\SMSGateway\SMSGateway;
//Load Composer's autoloader
require 'vendor/autoload.php';
// Please note that implementing a new_message_handling callback function
// will flag the new messages as read when returning from the function.
function new_message_handling($array) {
// Handling $array of new received messages
// [["device_id" => "device id",
// "message_id" => "message id",
// "from" => "from phone number",
// "sms_sent" => "sms_sent timestamp (ms)",
// "sms_received" => "sms_received timestamp (ms)",
// "content" => "message content",
// "last_update" => "last update timestamp (ms)",
// "status" => "UNREAD|READ"
// ],
// [...]
// ]
}
function update_handling($array) {
// Handling $array of status updates for sent messages
// [["device_id" => "device id",
// "message_id" => "message id",
// "to" => "to phone number",
// "content" => "content",
// "last_update" => "last update timestamp (ms)",
// "status" => "NEW|PUSHED|PENDING|SENT|DELIVERED|FAILED"
// ],
// [...]
// ]
}
function timeout_handling($array) {
// Handling $array of devices not seen during the last "DeviceTimeout" seconds
// [["device_id" => "device_id",
// "last_update" => "device_last_update"
// ],
// [...]
// ]
}
//Create an instance
$smsgateway = new SMSGateway();
// Set the data folder
$smsgateway->setDataPath(__DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR);
// Launch the API server with callback functions definition
$smsgateway->apiServer("secret", "new_message_handling", "update_handling", "timeout_handling");
A full working gateway implementation is available here : Online SMSGateway demo. Click the link and everything is self-explanatory. You will simply have to install and configure the companion open source Android app in order to send and receive SMS messages through this demo gateway (as explained after sending a first SMS message using the online demo gateway).
Example of how to use SMSGateway for a common scenario can be found in the examples folder. If you're looking for a good starting point, we recommend you start with the gateway example.
See CHANGELOG.
That's it. You should now be ready to use SMSGateway!
Files (8) |
File | Role | Description | ||
---|---|---|---|---|
examples (1 file, 1 directory) | ||||
src (1 file) | ||||
CHANGELOG.md | Doc. | Documentation | ||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Read me | ||
VERSION | Data | Auxiliary data |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.