always-open / laravel-auth-notifications
A Laravel package to notify your users when their password, two-factor authentication, or login status changes.
Installs: 10 921
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- illuminate/contracts: >=8.37
- spatie/laravel-package-tools: ^1.4.3
Requires (Dev)
- nunomaduro/collision: ^6.0
- orchestra/testbench: ^7.0
- phpunit/phpunit: ^9.5
README
A Laravel package to notify your users when their password, two-factor authentication, or login status changes.
Installation
You can install the package via composer:
composer require always-open/laravel-auth-notifications
You can publish the config file with:
php artisan vendor:publish --provider="AlwaysOpen\AuthNotifications\AuthNotificationsServiceProvider" --tag="laravel-auth-notifications-config"
Usage
By default all of the notifications are turned off. To enable them, declare the appropriate environment variable like AUTH_NOTIFICATIONS_LOGIN_VALIDATED=true
. Framework login events track the Illuminate\Auth\Events\Validated
, Illuminate\Auth\Events\Failed
, and Illuminate\Auth\Events\Lockout
events.
For credential notifications, we are simply watching the user model for changes. If you'd rather fire those events manually, set the corresponding field to a blank string and dispatch AlwaysOpen\AuthNotifications\Events\LoginWasChanged
, AlwaysOpen\AuthNotifications\Events\PasswordWasChanged
, AlwaysOpen\AuthNotifications\Events\TwoFactorWasEnabled
, or AlwaysOpen\AuthNotifications\Events\TwoFactorWasDisabled
with the only parameter being the user object to send to.
You may also override the notifications that are sent by creating your own notifications via php artisan make:notification
and overriding the class defined in the config/auth-notifications.php
.
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.