Skip to content

Submit pull requests here for new notification channels

License

Notifications You must be signed in to change notification settings

RingierIMU/sailthru-notifications-channel

 
 

Repository files navigation

Here's the latest documentation on Laravel 5.3 Notifications System:

https://laravel.com/docs/master/notifications

A Boilerplate repo for contributions

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 Sailthru with Laravel 5.8.

Note: Replace Sailthru Sailthru Dylan Harbour dylanharbour http://ringier.tech tools@roam.africa sailthru :package_description :style_ci_id :sensio_labs_id with their correct values in README.md, CHANGELOG.md, CONTRIBUTING.md, LICENSE.md, composer.json and other files, then delete this line. Tip: Use "Find in Path/Files" in your code editor to find these keywords within the package directory and replace all occurences with your specified term.

This is where your description should go. Add a little code example so build can understand real quick how the package can be used. Try and limit it to a paragraph or two.

Contents

Installation

  1. Add your Sailthru API details to config/services
'sailthru' => [
        'api_key' => '',
        'secret' => '',
    ],
  1. composer require laravel-notification-channels/sailthru-notifications-channel (Specify Repo until official package is added to the notifications channel repo)

  2. If required, register the SailthruServiceProvider

Setting up the Sailthru service

Sign Up on their Website

Usage

  1. Follow standard Notifiable/Notifications Setup for a model.
  2. If default / global vars are required for all Sailthru calls, add them using the sailthruDefaultVars method on your notifiable e.g.
    /**
     * @return array
     */
    public function sailthruDefaultVars(): array
    {
        return ['global_var_foo' => 'bar'];

    }
  1. Add a toSailthru method on your notification, where you define template name and any specific var.
    /**
     * @param User $user
     * @return SailthruMessage
     */
    public function toSailthru(User $user)
    {

        return SailthruMessage::create('reset password')
            ->toName($user->name)
            ->toEmail($user->email)
            ->vars(
                [
                    'reset_password_link' => 'https://www.example.com',
                    'link_expiration_minutes' => config('auth.reminder.expire', 60),
                    'first_name' => $user->name,
                ]
            );
    }
  1. Change the via() method in your notification to include the SailthruChannel.
    /**
     * Get the notification's channels.
     *
     * @param  mixed  $notifiable
     * @return array|string
     */
    public function via($notifiable)
    {
        return [SailthruChannel::class];
    }

Available Message methods

A list of all available options

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email tools@roam.africa 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 pull requests here for new notification channels

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%