@Authy notification channel for @Laravel, with the ability to send in-app, sms, and call verification tokens.

Related tags

Notifications authy
Overview

Authy Notification Channel for Laravel

Authy notification channel for Laravel, with the ability to send in-app, sms, and call verification tokens.

Packagist Scrutinizer Code Quality StyleCI Travis License

Authy Notifications

Table Of Contents

Usage

  1. Install the package via composer:

    composer require laravel-notification-channels/authy
  2. This package requires rinvex/laravel-authy package, so before proceeding make sure to follow up its installation steps first.

  3. Next, to route Authy notifications to the proper entity, define a routeNotificationForAuthy method on your notifiable entity. This should return the Authy Id to which the notification should be sent. Example:

    /**
     * Route notifications for the authy channel.
     *
     * @return int
     */
    public function routeNotificationForAuthy()
    {
        return $this->authy_id;
    }

    Note: as you might thought, this requires an authy_id attribute in your notifiable entity, for which you may need to create an additional field in the database table.

  4. Now you can create notifications that use Authy channel as follows:

    // app/Notifications/PhoneVerificationNotification.php
    
    namespace App\Notifications;
    
    use Illuminate\Notifications\Notification;
    use NotificationChannels\Authy\AuthyChannel;
    use NotificationChannels\Authy\AuthyMessage;
    
    class PhoneVerificationNotification extends Notification
    {
        /**
         * The notification method (sms/call).
         *
         * @var string
         */
        public $method;
    
        /**
         * Determine whether to force the notification over cellphone network.
         *
         * @var bool
         */
        public $force;
    
        /**
         * The notification message action.
         *
         * @var string
         */
        public $action;
    
        /**
         * The notification message action message.
         *
         * @var string
         */
        public $actionMessage;
    
        /**
         * Create a notification instance.
         *
         * @param string $method
         * @param bool   $force
         * @param string $action
         * @param string $actionMessage
         *
         * @return void
         */
        public function __construct($method = 'sms', $force = false, $action = null, $actionMessage = null)
        {
            $this->method = $method;
            $this->force = $force;
            $this->action = $action;
            $this->actionMessage = $actionMessage;
        }
    
        /**
         * Get the notification's channels.
         *
         * @param mixed $notifiable
         *
         * @return array|string
         */
        public function via($notifiable)
        {
            return [AuthyChannel::class];
        }
    
        /**
         * Build the Authy representation of the notification.
         *
         * @return \NotificationChannels\Authy\AuthyMessage
         */
        public function toAuthy()
        {
            $message = AuthyMessage::create()->method($this->method);
    
            if ($this->force) {
                $message->force();
            }
    
            if ($this->action) {
                $message->action($action);
            }
    
            if ($this->actionMessage) {
                $message->actionMessage($actionMessage);
            }
    
            return $message;
        }
    }
  5. Finally you can consume the notification as follows:

    $this->notify(new \App\Notifications\PhoneVerificationNotification('sms', true));

    Note: don't forget to read through Authy TOTP API documentation for further information.

  6. Done!

Upgrade

  • Upgrading To v2.x From v1.x

    API implementation is 100% backward compatible, but sandbox API has been dropped since it's officially deprecated. Also note that PHP7 is now required.

Changelog

Refer to the Changelog for a full history of the project.

Support

The following support channels are available at your fingertips:

Contributing & Protocols

Thank you for considering contributing to this project! The contribution guide can be found in CONTRIBUTING.md.

Bug reports, feature requests, and pull requests are very welcome.

Security Vulnerabilities

If you discover a security vulnerability within this project, please send an e-mail to security@rinvex.com. All security vulnerabilities will be promptly addressed.

About Rinvex

Rinvex is a software solutions startup, specialized in integrated enterprise solutions for SMEs established in Alexandria, Egypt since June 2016. We believe that our drive The Value, The Reach, and The Impact is what differentiates us and unleash the endless possibilities of our philosophy through the power of software. We like to call it Innovation At The Speed Of Life. That’s how we do our share of advancing humanity.

Trademarks

License

This software is released under The MIT License (MIT).

(c) 2016-2020 Rinvex LLC, Some rights reserved.

You might also like...
✈️ Whatsapp Notifications Channel for Laravel

Whatsapp Notifications Channel for Laravel This package makes it easy to send Whatsapp notification using Venom API with Laravel. This package was cre

Notion.so notifications channel for Laravel

Installation composer require astroshippers/notion-notification-channel Usage Inside eloquent model: public function routeNotificationForNotion(): arr

Slack notification for Laravel as it should be. Easy, fast, simple and highly testable.
Slack notification for Laravel as it should be. Easy, fast, simple and highly testable.

Based on illuminate/mail About Laravel Slack Slack notification for Laravel as it should be. Easy, fast, simple and highly testable. Since it uses On-

Multiple channels of laravel exception notification(DingTalk、FeiShu、ServerChan、WeWork、XiZhi). - 多种通道的 laravel 异常通知(钉钉群机器人、飞书群机器人、Server 酱、企业微信群机器人、息知)。
Multiple channels of laravel exception notification(DingTalk、FeiShu、ServerChan、WeWork、XiZhi). - 多种通道的 laravel 异常通知(钉钉群机器人、飞书群机器人、Server 酱、企业微信群机器人、息知)。

laravel-exception-notify 简体中文 | ENGLISH Multiple channels of laravel exception notification(DingTalk、FeiShu、ServerChan、WeWork、XiZhi). - 多种通道的 laravel

SMS service provider for Laravel

laravel-sms SMS service provider for Laravel and Lumen. Uses SMS Client to enable sending SMS messages using the following drivers: nexmo clockwork te

A Toast notification library for the Laravel TALL stack.
A Toast notification library for the Laravel TALL stack.

A Toast notification library for the Laravel TALL stack. You can push notifications from the backend or frontend to render customizable toasts with almost zero footprint on the published CSS/JS 🔥🚀

AmaranJS stylish notification for your laravel application.

AmaranJS Laravel 5 Package AmaranJS L5 package is a Laravel wrapper for my jquery plugin AmaranJS.You can create easy and stylish notifications with A

Our Laravel Sendgrid Notification package

laravel-sendgrid-notification-channel Laravel Sendgrid Notification channel Installation To get started, you need to require this package: composer re

 Lara-Izitoast : Laravel Notification Package
Lara-Izitoast : Laravel Notification Package

Lara-Izitoast : Laravel Notification Package This is a laravel notification wrapper build with http://izitoast.marcelodolce.com javascript library. Ho

Comments
  • Code review

    Code review

    Hi @Omranic,

    Nice work! I did a quick code review on this repo and made the following changes so this package works more or less the same as the others ones in our organization:

    • added a static methodmissingCredentials in the InvalidConfiguration class
    • the styleci preset has been set to laravel

    In general think in general passing booleans to methods makes for less readable code. I've also changed the force method so that it doesn't take a bool anymore and added a dedicated method doNotForce that sets the force property to false.

    Because of that change I've also removed the current 1.0.0 tags and added 0.0.1. Why? Because tagging something with a version less than 1.0.0 breaking changes are still allowed (and the force method change is breaking. Feel free to tag it as 1.0.0 if you feel it's ready now.

    Your package is now registered on packagist, I've also added you as a member to the laravel-notification-channels.

    If I've done anything you don't like or if there's anything I can do for you, reopen this issue.

    Thanks again for your package. I'm pretty sure a lot of people will like it. 👍

    opened by freekmurze 2
  • Laravel 8 Support

    Laravel 8 Support

    Laravel 8 has been released today and we need to update this repo to support it. See https://laravel.com/docs/8.x/upgrade & https://github.com/laravel-notification-channels/channels/issues/107

    opened by atymic 1
  • Allow rinvex/laravel-authy to be updated

    Allow rinvex/laravel-authy to be updated

    Currently rinvex/laravel-authy is stuck at 7.0 as it is defined as v7.0.0 in composer.json

    Changing it to ^7.0.0 will allow it to be updated to 7.1.0 (The current latest release)

    opened by ziming 1
Owner
Laravel Notification Channels
A collection of custom notification drivers for Laravel
Laravel Notification Channels
Laravel SMS Notification Channel

Laravel SMS Notification Channel Installation composer require guangda/laravel-sms-notification-channel env 配置 SMS_PROVIDER=yunpian SMS_SIGNATURE=【签名

Guangda 6 Dec 29, 2021
An SMS notification channel for the PHP framework Laravel.

Laravel SMS notification channel An SMS notification channel for the PHP framework Laravel. Supported SMS gateways: 46elks Cellsynt Telenor SMS Pro Tw

Andreas 2 Jan 22, 2022
A package for verifying a user via call or SMS

Verify your users by call or SMS It's a common practice: a user signs up, you send an SMS to their phone with a code, they enter that code in your app

Worksome 122 Jan 3, 2023
Google Chat - Laravel Notification Channel

Google Chat - Laravel Notification Channel This package makes it easy to send notifications using Google Chat , (formerly known as Hangouts Chat) with

Laravel Notification Channels 36 Dec 6, 2022
Lark Notification Channel for laravel.

Lark notifications channel for Laravel This package makes it easy to send Lark using the Laravel notification system. Supports 5.5+, 6.x, 7.x and 8.x.

null 1 Nov 3, 2021
Laravel FCM (Firebase Cloud Messaging) Notification Channel

Laravel FCM Notification Laravel FCM (Firebase Cloud Messaging) Notification Channel Use this package to send push notifications via Laravel to Fireba

Vishal Dudhatra 3 Jul 3, 2022
Implementations for different SMS providers for EspoCRM. Can be used for 2-factor authentication or automatic SMS sending via Workflow and BPM tools.

SMS Providers for EspoCRM An installable extension. Supported SMS Providers Twilio Spryng sms77 Setting up Install the extension. At Administration >

EspoCRM - Open Source CRM 11 Nov 30, 2022
laravel send sms. kavenegar, ghasedak

Requirements laravel >= 7 Installation composer require ehsanmoradi/laravel-sms Publish the configuration file (this will create a laravel-sms.php

ehsan moradi 3 Feb 6, 2022
Send SMS with easy using BEEM

beem-sms-api Send SMS with easy using BEEM Installation You must be using composer to be able to use this library. If composer 1.x is installed, make

Hosanna Higher Technologies 4 Dec 24, 2021
📨 Facebook Notifications Channel for Laravel

Facebook Notifications Channel for Laravel This package makes it easy to send notifications using the Facebook Messenger with Laravel. Contents Instal

Laravel Notification Channels 142 Dec 27, 2022