Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Authentication Log Laravel Package

rappasoft/laravel-authentication-log

View on GitHub
Deep Wiki
Context7

title: Notifications weight: 2

Notifications may be sent on the mail, vonage (formerly Nexmo), and slack channels but by default notify via email.

You may define a notifyAuthenticationLogVia method on your authenticatable models to determine which channels the notification should be delivered on:

public function notifyAuthenticationLogVia()
{
    return ['vonage', 'mail', 'slack'];
}

You must install the Slack and Vonage drivers to use those routes and follow their documentation on setting it up for your specific authenticatable models.

New Device Notifications

Enabled by default, they use the \Rappasoft\LaravelAuthenticationLog\Notifications\NewDevice class which can be overridden in the config file.

Rate Limiting

New device notifications are rate-limited by default to prevent spam. You can configure this in the config file:

'new-device' => [
    'rate_limit' => 3, // Maximum 3 notifications per time period
    'rate_limit_decay' => 60, // Time period in minutes
],

This means a user will receive a maximum of 3 new device notifications per hour. Additional logins from new devices within that time period will not trigger notifications.

Failed Login Notifications

Disabled by default, they use the \Rappasoft\LaravelAuthenticationLog\Notifications\FailedLogin class which can be overridden in the config file.

Rate Limiting

Failed login notifications also support rate limiting:

'failed-login' => [
    'rate_limit' => 5, // Maximum 5 notifications per time period
    'rate_limit_decay' => 60, // Time period in minutes
],

Suspicious Activity Notifications

Disabled by default, suspicious activity notifications use the \Rappasoft\LaravelAuthenticationLog\Notifications\SuspiciousActivity class which can be overridden in the config file.

When enabled, users will receive notifications when suspicious activity is detected, including:

  • Multiple failed login attempts
  • Rapid location changes
  • Unusual login times (if enabled)

Enabling Suspicious Activity Notifications

Add to your .env file:

SUSPICIOUS_ACTIVITY_NOTIFICATION=true

Or configure in config/authentication-log.php:

'suspicious-activity' => [
    'enabled' => env('SUSPICIOUS_ACTIVITY_NOTIFICATION', false),
    'location' => function_exists('geoip'),
    'template' => \Rappasoft\LaravelAuthenticationLog\Notifications\SuspiciousActivity::class,
    'rate_limit' => env('SUSPICIOUS_ACTIVITY_NOTIFICATION_RATE_LIMIT', 3),
    'rate_limit_decay' => env('SUSPICIOUS_ACTIVITY_NOTIFICATION_RATE_LIMIT_DECAY', 60),
],

Rate Limiting

Suspicious activity notifications support rate limiting to prevent notification spam:

'suspicious-activity' => [
    'rate_limit' => 3, // Maximum 3 notifications per time period
    'rate_limit_decay' => 60, // Time period in minutes
],

This means a user will receive a maximum of 3 suspicious activity notifications per hour, even if multiple suspicious activities are detected.

Location

If the torann/geoip package is installed, it will attempt to include location information to the notifications by default.

You can turn this off within the configuration for each template.

Note: By default when working locally, no location will be recorded because it will send back the default address from the geoip config file. You can override this behavior in the email templates.

Custom Notification Templates

You can override the notification classes in the config file:

'notifications' => [
    'new-device' => [
        'template' => \App\Notifications\CustomNewDevice::class,
    ],
    'failed-login' => [
        'template' => \App\Notifications\CustomFailedLogin::class,
    ],
    'suspicious-activity' => [
        'template' => \App\Notifications\CustomSuspiciousActivity::class,
    ],
],

Your custom notification classes should extend the base notification classes or implement the same interface.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope