laravel-notification-channels/authy
Composer 安装命令:
composer require laravel-notification-channels/authy
包简介
Authy notification channel for Laravel, with the ability to send in-app, sms, and call verification tokens.
README 文档
README
Authy notification channel for Laravel, with the ability to send in-app, sms, and call verification tokens.
Table Of Contents
- Usage
- Upgrade
- Changelog
- Support
- Contributing & Protocols
- Security Vulnerabilities
- About Rinvex
- Trademarks
- License
Usage
-
Install the package via composer:
composer require laravel-notification-channels/authy
-
This package requires
rinvex/laravel-authypackage, so before proceeding make sure to follow up its installation steps first. -
Next, to route Authy notifications to the proper entity, define a
routeNotificationForAuthymethod 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_idattribute in your notifiable entity, for which you may need to create an additional field in the database table. -
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; } }
-
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.
-
Done!
Upgrade
-
Upgrading To
v2.xFromv1.xAPI 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
- Authy™ is a trademark of Twilio Inc.
- Laravel™ is a trademark of TAYLOR OTWELL
License
This software is released under The MIT License (MIT).
(c) 2016-2020 Rinvex LLC, Some rights reserved.
laravel-notification-channels/authy 适用场景与选型建议
laravel-notification-channels/authy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 46.69k 次下载、GitHub Stars 达 57, 最近一次更新时间为 2016 年 10 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sms」 「phone」 「laravel」 「token」 「authy」 「call」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 laravel-notification-channels/authy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 laravel-notification-channels/authy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 laravel-notification-channels/authy 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Phone helper & validator for Nette Framework
Yii2 phone formatter and validator.
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
Extensible library for building notifications and sending them via different delivery channels.
yii2-sms expand
Yii2 extension for Mobile-Detect library
统计信息
- 总下载量: 46.69k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 58
- 点击次数: 22
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-10-24