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

Last update: Feb 14, 2022

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 [email protected]. 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.

GitHub

https://github.com/laravel-notification-channels/authy
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

Jun 26, 2022

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

May 27, 2022

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-

May 13, 2022

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 🔥🚀

Jul 2, 2022

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

Oct 3, 2019

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

May 12, 2022

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

Feb 3, 2022

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

Jan 4, 2022

Notification package for Laravel

Package is looking for maintainers Please contact me if interested. Notification package for Laravel4 / Laravel5 A simple notification management pack

Jun 21, 2022
Comments
  • 1. 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. 👍

    Reviewed by freekmurze at 2016-10-24 08:36
  • 2. 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

    Reviewed by atymic at 2020-09-08 10:22
  • 3. 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)

    Reviewed by ziming at 2020-07-10 01:33
Related tags
Laravel SMS Notification Channel

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

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

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

Jun 20, 2022
Google Chat - Laravel Notification Channel
 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

May 4, 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.

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

Jun 30, 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 >

Jun 15, 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

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

Dec 24, 2021
📨 Facebook Notifications Channel for Laravel
📨 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

Jun 30, 2022