library cmdirect
CMDirect.nl SMS - PHP Library.
pharmaintelligence/cmdirect
CMDirect.nl SMS - PHP Library.
- Monday, February 16, 2015
- by linde002
- Repository
- 1 Watchers
- 0 Stars
- 126 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 2 % Grown
CMDirect
Interface library for CMDirect.nl, (*1)
Example:
<?php
use PharmaIntelligence\CMDirect\Message;
use PharmaIntelligence\CMDirect\Adapter\CurlRequestAdapter;
use PharmaIntelligence\CMDirect\Service\CMCorporateService;
$adapter = new CurlRequestAdapter();
$adapter->setRequestUrl('http://cm-gateway.url/endpoint');
// Use the CMDirectService if you are a user of cmdirect.nl
// Use the CMCorporateService if you use the batch gateway for corporate users
$service = new CMCorporateService($adapter, 007, 'BondJamesBond', 'shakenNotStirred');
$message = new Message();
$message
->setFrom('YourCompany')
->setTo('0123456789')
->setBody('Hi this is a text message');
// Use this for batches
$service->queue($message);
$response = $service->send();
// Use this for single messages
$response = $service->sendImmediately($message);
if(!$response->isSuccessful()) {
$error = $response->getError();
// Do something with this error
}