PHP client for Scrypt's Sfax service.
composer require rootwork/php-sfax
<?php
$sfax = new Rootwork\Sfax\Client(
'https://api.sfaxme.com/api',
'YOURUSERNAME',
'YOURAPIKEY',
'YOURENCRYPTIONKEY',
'YOURIV'
);
<?php
$result = $sfax->sendFax(
'Malcolm Reynolds',
'19999999999',
'/path/to/file.pdf'
);
if ($result->isSuccess) {
$queueId = $result->SendFaxQueueId;
}
<?php
$result = $sfax->sendFaxFromUrl(
'Malcolm Reynolds',
'19999999999',
Rootwork\Sfax\Client::FORMAT_TIF,
'https://www.yoursite.com/getFile?token=ABC123&file=12345678.tif'
);
<?php
$result = $sfax->receiveInboundFax();
foreach ($result->InboundFaxItems as $fax) {
$fileData = $sfax->downloadInboundFaxAsPdf($fax->FaxId);
file_put_contents("/faxes/$fax->FaxId.pdf", $fileData);
}
Tests can be run using composer helper scripts, test
or testdox
, depending on your output preferences.
composer install
composer test
composer testdox
Code coverage reports are written to build/
.