PHPackages                             omarabdelrady/laravel-auth-log - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. omarabdelrady/laravel-auth-log

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

omarabdelrady/laravel-auth-log
==============================

Laravel Auth Log provides authentication logger and notification for Laravel.

018PHP

Since Jul 25Pushed 3y ago1 watchersCompare

[ Source](https://github.com/omarabdelrady/laravel-auth-log)[ Packagist](https://packagist.org/packages/omarabdelrady/laravel-auth-log)[ RSS](/packages/omarabdelrady-laravel-auth-log/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Auth Log
================

[](#laravel-auth-log)

[![Build Status](https://camo.githubusercontent.com/e343d73757575b5f39231606f5023dca380e6eb6e92caaf558162ade0972c80e/68747470733a2f2f7472617669732d63692e636f6d2f53616d75656c4e6974736368652f6c61726176656c2d617574682d6c6f672e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/SamuelNitsche/laravel-auth-log)[![StyleCI](https://camo.githubusercontent.com/a33c97af395191ff8b6cde7da62571a1c9ceb260497be1600bd4947fa15e372b/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3138383431393435362f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/188419456)

Laravel Auth Log is a package to automatically log all logins of your users. It can also send notifications when a successful login was made from an unknown device.

This package is a modified and extended version of .

Installation
------------

[](#installation)

> Laravel Auth Log requires Laravel 5.8 or higher, and PHP 7.2+.

You may use Composer to install Laravel Auth Log into your Laravel project:

```
composer require samuelnitsche/laravel-auth-log

```

### Configuration

[](#configuration)

After installing the Laravel Auth Log, publish its config, migration and view, using the `vendor:publish` Artisan command:

```
php artisan vendor:publish --provider="SamuelNitsche\AuthLog\AuthLogServiceProvider"

```

Next, you need to migrate your database. The Laravel Auth Log migration will create the table your application needs to store auth logs:

```
php artisan migrate

```

Finally, add the `AuthLogable` and `Notifiable` traits to your authenticatable model (by default, `App\User` model). These traits provides various methods to allow you to get common auth log data, such as last login time, last login IP address, and set the channels to notify the user when login from a new device:

```
use SamuelNitsche\AuthLog\AuthLogable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable, AuthLogable;
}
```

### Basic Usage

[](#basic-usage)

Get all authentication logs for the user:

```
User::find(1)->authentications;
```

Get the user last login info:

```
User::find(1)->lastLoginAt();

User::find(1)->lastLoginIp();
```

Get the user previous login time &amp; ip address (ignoring the current login):

```
auth()->user()->previousLoginAt();

auth()->user()->previousLoginIp();
```

### Notify login from a new device

[](#notify-login-from-a-new-device)

Notifications may be sent on the `mail`, `nexmo`, and `slack` channels. By default notify via email.

You may define `notifyAuthenticationLogVia` method to determine which channels the notification should be delivered on:

```
/**
 * The Auth Log notifications delivery channels.
 *
 * @return array
 */
public function notifyAuthenticationLogVia()
{
    return ['nexmo', 'mail', 'slack'];
}
```

Of course you can disable notification by set the `notify` option in your `config/auth-log.php` configuration file to `false`:

```
'notify' => env('AUTH_LOG_NOTIFY', false),
```

### Clear old logs

[](#clear-old-logs)

You may clear the old auth log records using the `auth-log:clear` Artisan command:

```
php artisan auth-log:clear

```

Records that is older than the number of days specified in the `older` option in your `config/auth-log.php` will be deleted:

```
'older' => 365,
```

Contributing
------------

[](#contributing)

Thank you for considering contributing to the Laravel Auth Log.

License
-------

[](#license)

Laravel Auth Log is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/13fa1c6cdf270ea46f5543ffbcc98462896d0dbca29f21ade440256e1df6cb40?d=identicon)[omarabdelrady](/maintainers/omarabdelrady)

---

Top Contributors

[![omarabdelrady](https://avatars.githubusercontent.com/u/104464731?v=4)](https://github.com/omarabdelrady "omarabdelrady (2 commits)")

### Embed Badge

![Health badge](/badges/omarabdelrady-laravel-auth-log/health.svg)

```
[![Health](https://phpackages.com/badges/omarabdelrady-laravel-auth-log/health.svg)](https://phpackages.com/packages/omarabdelrady-laravel-auth-log)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
