codechito/laravel-transmitmessage-channel

dev-master 2020-01-29 02:33 UTC

This package is auto-updated.

Last update: 2024-03-29 04:12:14 UTC


README

Please see this repo for instructions on how to submit a channel proposal.

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 TransmitMessage with Laravel 5.5+ and 6.x

Contents

Installation

You can install the package via composer:

composer require codechito/laravel-transmitmessage-channel

Setting up the TransmitMessage service

Add the environment variables to your config/services.php:

// config/services.php
...
'transmitmessage' => [
    'apiKey' => env('TRANSMITMESSAGE_APIKEY'),
],
...

Add your TransmitMessage API Key to your .env:

// .env
...
TRANSMITMESSAGE_APIKEY=
],
...

Usage

You can use the channel in your via() method inside the notification:

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use NotificationChannels\TransmitMessage\TransmitMessageChannel;
use NotificationChannels\TransmitMessage\TransmitMessageMessage;

class SmsSend extends Notification
{
    use Queueable;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [TransmitMessageChannel::class];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toTransmitMessage($notifiable)
    {
        return (new TransmitMessageMessage())
                    ->setMessage('The introduction to the notification.')
                    ->setRecipient('639481234567')
                    ->setSender('SHARKY');
    }
}

Available Message methods

A list of all available options

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Known Issues

if you encounter these error

 certificate problem: unable to get local issuer certificate

for production we recommend to follow these link for fixing these issue

https://ourcodeworld.com/articles/read/211/unirest-for-php-ssl-certificate-problem-unable-to-get-local-issuer-certificate

but if you are in a rush and working only in local enviroment you can just replace the following

  1. go to \vendor\transmitmessage\php-client-sdk\src\Configuration.php
  2. replace https://api.transmitmessage.com/v1/ with http://api.transmitmessage.com/v1/

these will fixed the issue temporarily

Security

If you discover any security related issues, please email chito@burstsms.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.