PHP code example of enricodias / smsdev

1. Go to this page and download the library: Download enricodias/smsdev 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/ */

    

enricodias / smsdev example snippets


$SmsDev = new \enricodias\SmsDev('API_KEY');

$SmsDev->setDateFormat('Y-m-d H:i:s'); // default is 'U', timestamp

$SmsDev->send(5511988881111, 'SMS Message'); // returns true if the API accepts the message

var_dump($SmsDev->getResult()); // Returns the raw API response.

$SmsDev->setNumberValidation(false); // disables phone number validation

$SmsDev->setDateFormat('Y-m-d');

$SmsDev->setFilter()
            ->isUnread()
            ->dateBetween('2018-01-19', '2019-01-19')
        ->fetch();

$SmsDev->setFilter()
            ->byId(2515974)
        ->fetch();

$SmsDev->setDateFormat('U'); // timestamp

$messages = $SmsDev->parsedMessages();

var_dump($messages);

/*
array(1) {
    ['date']    => '1529418914'
    ['number']  => '5511988887777'
    ['message'] => 'Message'
}
*/

$SmsDev->setFilter()
            ->dateBetween('2018-01-19', '2019-01-19')
        ->fetch();

$SmsDev->setFilter()
            ->dateBetween('2018-01-19', '')
            ->dateTo('2019-01-19')
        ->fetch();

$SmsDev->setFilter()
            ->dateBetween('', '2019-01-19')
            ->dateFrom('2018-01-19')
        ->fetch();

$SmsDev->setFilter()
            ->dateFrom('2018-01-19')
            ->dateTo('2019-01-19')
        ->fetch();