notifylog/laravel

Real-time event notification

v1.0.0 2023-01-16 23:39 UTC

This package is not auto-updated.

Last update: 2024-04-09 17:59:05 UTC


README

A library for sending notifications using the NotifyLog API.

Installation

To install the library, run the following command:

composer require notifylog/laravel

Configuration

To use the library, configure your Account Token in .env

NOTIFYLOG_ACCOUNT_TOKEN=[account_token]

You can find your Account Token here

Test your Configuration

run

php artisan notifylog:test

Usage

Then, you can use NotifyLog publish method to send a notification from within your controller

<?php

namespace App\Http\Controllers;

use Illuminate\Routing\Controller as BaseController;
use NotifyLog\Laravel\NotifyLog;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;



    function index(NotifyLog $notifyLog){


        $event = [
            "name" =>  "NotifyLog Laravel Plugin",
            "description" =>  "Hello world from Laravel",
            "channel" =>  "from-laravel",
            "icon" =>  "💸",
            "notify" =>  true,
            "tags" => [
                "my-tag" =>  "my-tag-value",
            ],
            "message" =>
                "[Link](https://google.com)",
        ];

       // Use:
       $notifyLog->publish($event);

       // or, you can also use the helper
       // without the need to inject
       // NotifyLog into the controller
       // by calling

       notifylog()->publish($event);

Support

If you need help, please send an email to hello@notifylog.com.

Create an account

To create an account on the NotifyLog platform, visit https://notifylog.com.