Skip to content

ivinteractive/channels

 
 

Repository files navigation

InterFAX notification channel for Laravel 5.8+ and 6.x

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads

This package makes it easy to send notifications using InterFAX with Laravel 5.8+ and 6.0

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.

About

Submit suggestions & pull requests here for new notification channels

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%