laravel-notification-channels / interfax
This package makes it easy to send files as faxes via InterFAX with Laravel notifications
Requires
- php: ^7.2
- illuminate/notifications: ^6.0|^7.0|^8.0
- illuminate/support: ^6.0|^7.0|^8.0
- interfax/interfax: ^1.1
Requires (Dev)
- mockery/mockery: ^1.0
- mpdf/mpdf: ^8.0
- orchestra/testbench: ~4.0|~5.0|~6.0
- phpunit/phpunit: ^8.0|^9.3.3
This package is auto-updated.
Last update: 2021-01-10 15:05:53 UTC
README
This package makes it easy to send notifications using InterFAX with Laravel 6.x and above.
Contents
Installation
You can install this package via composer:
composer require laravel-notification-channels/interfax
The service provider gets loaded automatically.
Setting up the InterFAX service
This channel will use your InterFAX username and password. To use the channel, add this to your config/services.php
file:
... 'interfax' => [ 'username' => env('INTERFAX_USERNAME'), 'password' => env('INTERFAX_PASSWORD'), 'pci' => env('INTERFAX_PCI', false), ], ...
This will load your InterFAX credentials from the .env
file. If your requests must be PCI-DSS-compliant, set INTERFAX_PCI=true
in your .env
file.
Usage
To use this package, you can create a notification class, like DocumentWasSent
from the example below, in your Laravel application. Make sure to check out Laravel's documentation for this process.
Send PDF via fax
<?php use NotificationChannels\Interfax\InterfaxChannel; use NotificationChannels\Interfax\InterfaxMessage; class DocumentWasSent extends Notification { protected $files; public function __construct(array $files) { $this->files = $files; } /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return [InterfaxChannel::class]; } public function toInterfax($notifiable) { return (new InterfaxMessage) ->files($this->files); } }
The Notifiable model will need to return a destination fax number.
public function routeNotificationForInterfax($notification) { if($this->fax) return preg_replace('/[^\d]/', '', $this->fax); return null; }
Available Message methods
file(string $file)
: Accepts the full path to a single file (full list of supported file types found here).
files(array $array)
: Accepts an array of file paths.
stream(Filestream $stream, string $name)
: Accepts a file stream.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email craig.spivack@ivinteractive.com instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.