PHPackages                             msogl/sfax - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. msogl/sfax

ActiveLibrary[API Development](/categories/api)

msogl/sfax
==========

PHP Api for Sfax

v1.0.2(1y ago)011MITPHPPHP &gt;=7.3

Since Jul 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/msogl/Sfax)[ Packagist](https://packagist.org/packages/msogl/sfax)[ RSS](/packages/msogl-sfax/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

SfaxApi
=======

[](#sfaxapi)

PHP API for sending a fax via Sfax.

Based on the documentation at .

The PHP code sample there is outdated and uses the old mcrypt libraries in PHP. This uses OpenSSL.

Install
-------

[](#install)

```
composer require msogl/sfax

```

Configuration
-------------

[](#configuration)

This uses a $config array, like so:

```
$config = [
    'SFAX_USERNAME' => 'your sfax username',
    'SFAX_APIKEY' => 'your sfax api key'',
    'SFAX_ENCKEY' => 'your sfax encryption key',
    'SFAX_IV' => 'your sfax init vector',
    'SFAX_CLIENT' => 'your sfax client',
];

```

You can build the $config array any way you like.

NOTE: SFAX\_CLIENT is optional. You can leave it off, or leave it on, but blank.

Sending a fax
-------------

[](#sending-a-fax)

```
// $fromFaxNumber should either be specified, or, if using the default fax number
// associated with the user account for the API, set it to the literal
// string, "DEFAULT".
$fromFaxNumber = 'DEFAULT';

// Fax number including area code. The API assumes as U.S. number, so will auto-add
// the country code of "1". The API will auto-format the number to all numbes, so
// you can leave dashes in, if you want.
$recipientFaxNumber = '555-555-5555';

// A recipient name is required. You may use free-text. If you don't have a name,
// just put the fax number in here as well.
$recipientFaxName = 'Some Company Name';

$sfax = new SfaxApi($config);
$resp = $sfax->sendFax($fromFaxNumber, $recipientFaxNumber, $recipientFaxName, $faxFilePath);

if ($resp === false) {
    echo $sfax->lastError . "\n";
} else {
    var_dump($resp);
}

```

Test mode
---------

[](#test-mode)

You can put the API in test mode. Doing so will allow you to call our API code without actually calling Sfax's API. Instead, it will return the composed URL for the API in the $lastError field and return false before Sfax's API is called.

```
$sfax = new SfaxApi($config);
$sfax->testMode();
$resp = $sfax->sendFax($fromFaxNumber, $recipientFaxNumber, $recipientFaxName, $faxFilePath);

if ($resp === false) {
    echo $sfax->lastError . "\n";
} else {
    var_dump($resp);
}

```

Using a named cover page
------------------------

[](#using-a-named-cover-page)

Sfax supports including a cover page via their templated cover pages, as defined in their system.

Unfortunately, it does not support sending their templated cover page alone. A PDF file must still be sent along.

The name of the coverpage defaults to "None". If the name is different than "None" (case-insensitive) then a cover page will be sent. Only parameters that are populated will be used. There isn't much logic around this, so be careful about array parameter names.

```
$sfax = new \Msogl\Sfax\SfaxApi($config);

$sfax->setCoverPage([
    'name' => 'Sfax traditional cover page',
    'subject' => 'Testing only',
    'reference' => 'Ref # here',
    'remarks' => 'This is just a test. Please ignore.',
    'fromname' => 'Your name nere',
    'fromphone' => 'Your phone nere',
    'timezone' => 'see the API specifications',
]);

$resp = $sfax->sendFax($fromFaxNumber, $recipientFaxNumber, $recipientFaxName, $pdfFile);

```

Getting a usage report
----------------------

[](#getting-a-usage-report)

$startDate can be null or a specific date. If null, it will automatically be 30 days prior to the current date. $endDate can be null or a specific date. If null, it will be the current date.

```
// Get usage report for last 30 days
$sfax = new SfaxApi($config);
$resp = $sfax->usageReport(null, null);

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

675d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc7c4a46e9d3d4cd0beee919ef260959facb45020794cfdf7dc0997c623440fb?d=identicon)[jclark@msogl.com](/maintainers/jclark@msogl.com)

---

Top Contributors

[![msogl](https://avatars.githubusercontent.com/u/116600459?v=4)](https://github.com/msogl "msogl (13 commits)")

### Embed Badge

![Health badge](/badges/msogl-sfax/health.svg)

```
[![Health](https://phpackages.com/badges/msogl-sfax/health.svg)](https://phpackages.com/packages/msogl-sfax)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
