1. Go to this page and download the library: Download gajus/nexmore library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gajus / nexmore example snippets
/**
* @param string $key Nexmo account API key.
* @param string $secret Nexmo account secret key for signing the API requests.
* @param string $api_url
*/
$messenger = new \Gajus\Nexmore\Messenger($key, $secret);
/**
* A long SMS is split into chunks of 153 chars (in Unicode content messages 67).
*
* @see https://help.nexmo.com/entries/24578133-How-multipart-SMS-is-constructed-
* @see https://docs.nexmo.com/index.php/sms-api/send-message
* @param string $from
* @param string $to
* @param string $text
* @param array $parameters
*/
$messenger->sms(string $from, string $to, string $text[, array $parameters]);
/**
* Listens to Nexmo Delivery Receipt. All knonw receipt $_GET parameters are mapped to
* a $receipt property. Parameter names are canonicalized.
*
* @param string $key
* @param string $secret
* @param boolean $debug Debug allows indbound traffic to come from outside of the safe subnet.
*/
$listener = new \Gajus\Nexmore\Listener();
$delivery_receipt = $listener->getDeliveryReceipt();
$inbound_message = $listener->getInboundMessage();
if ($delivery_receipt) {
var_dump($delivery_receipt);
}
if ($inbound_message) {
var_dump($inbound_message);
}