PHPackages                             moecasts/laravel-user-login-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. moecasts/laravel-user-login-log

ActiveLibrary

moecasts/laravel-user-login-log
===============================

A package for log user login info

1.0.1(6y ago)324MITPHPPHP ^7.2

Since Mar 25Pushed 5y agoCompare

[ Source](https://github.com/MoeCasts/laravel-user-login-log)[ Packagist](https://packagist.org/packages/moecasts/laravel-user-login-log)[ RSS](/packages/moecasts-laravel-user-login-log/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

Laravel User Login log
======================

[](#laravel-user-login-log)

Document
--------

[](#document)

[English](./readme.md)[中文](./readme_ZH.md)

[![Build Status](https://camo.githubusercontent.com/215e3616fa5f7251d71a36242c9fc0a72a05c39e6470c8951e8d66efda692485/68747470733a2f2f7777772e7472617669732d63692e6f72672f4d6f6543617374732f6c61726176656c2d77616c6c65742e7376673f6272616e63683d6d6173746572)](https://www.travis-ci.org/MoeCasts/laravel-wallet)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/3ca52d743f524e7303a2ff63782e81e43026761f3f2f5e96fc849d76260291ea/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d6f6543617374732f6c61726176656c2d757365722d6c6f67696e2d6c6f672f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/MoeCasts/laravel-user-login-log/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/9e7f75e977b5cfdb75c5a27387520fb44d7b1430ad77b21d7696b3eb0b059235/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d6f6543617374732f6c61726176656c2d757365722d6c6f67696e2d6c6f672f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/MoeCasts/laravel-user-login-log/?branch=master)[![Code Intelligence Status](https://camo.githubusercontent.com/d927a69665ca9acd7adf5b94192eddb020fb0f3972bec9d7e17201fa497bb60e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d6f6543617374732f6c61726176656c2d757365722d6c6f67696e2d6c6f672f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)[![Code Intelligence Status](https://camo.githubusercontent.com/eed0b4bc1cc94505a5b8ce2eb4209783f6f6a4f7b4ecf10474498f9536984820/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4d6f6543617374732f6c61726176656c2d757365722d6c6f67696e2d6c6f67)](https://camo.githubusercontent.com/eed0b4bc1cc94505a5b8ce2eb4209783f6f6a4f7b4ecf10474498f9536984820/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4d6f6543617374732f6c61726176656c2d757365722d6c6f67696e2d6c6f67)

Feature
-------

[](#feature)

- Log user login records
- Analyse user login logs

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

[](#installation)

### Required

[](#required)

- PHP 7.0+
- Laravel 5.5+

You can install the package using composer

```
composer require moecasts/laravel-user-login-log
```

If you are using Laravel &lt; 5.5, you need to add provider to your config/app.php providers array:

```
Moecasts\Laravel\UserLoginLog\UserLoginLogServiceProvider,
```

Publish the mirgrations file:

```
php artisan vendor:publish --tag=laravel-user-login-log-migrations
```

As optional if you want to modify the default configuration, you can publish the configuration file:

```
php artisan vendor:publish --tag=laravel-user-login-log-config
```

And create tables:

```
php artisan migrate
```

Configurations
--------------

[](#configurations)

```
return [
    /**
     * cache avtive time (seconds)
     */
    'expire' => 300,
];
```

Usage
-----

[](#usage)

Firstly, add `LoginLoggable` trait to your authenticatable model.

```
use Moecasts\Laravel\UserLoginLog\Traits\LoginLoggable;

class User extends Authenticatable
{
    use LoginLoggable;
}
```

Next, simply register the newly created class after auth middleware in your middleware stack.

```
// app/Http/Kernel.php

class Kernel extends HttpKernel
{
    protected $routeMiddleware = [
        'auth' => \App\Http\Middleware\Authenticate::class,
        // ...
        'login.log' => \Moecasts\Laravel\UserLoginLog\Middleware\UserLoginLogMiddleware::class,
    ];

    // ...
}
```

Finally, use the middleware:

```
Route::get('hello')->middleware(['auth', 'login.log']);
```

### Methods

[](#methods)

#### Get user's logs

[](#get-users-logs)

```
$user = new User;
$user->loginLogs;
```

#### Create user login log

[](#create-user-login-log)

```
$user = new User;
$user->createLoginLog();
```

#### Log when user newly login

[](#log-when-user-newly-login)

This function is depet on cache, when your newly login, it will set a cache with for `$seconds` or default config ( `loginlog.expire` ) seconds when `$seconds` is not set.

```
$user = new User;
// $user->logLogin($seconds = null)
$user->logLogin();
```

#### Check is new login

[](#check-is-new-login)

```
$user = new User;
$user->isNewLogin();
```

### Let's enjoy coding!

[](#lets-enjoy-coding)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2238d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/33d985a42d1eba6a6c5cd25ffb577f25c3ed94255269a71be995ee0b81f060c6?d=identicon)[MoeCasts](/maintainers/MoeCasts)

---

Top Contributors

[![moecasts](https://avatars.githubusercontent.com/u/37169906?v=4)](https://github.com/moecasts "moecasts (10 commits)")

---

Tags

laraveluser-login-log

### Embed Badge

![Health badge](/badges/moecasts-laravel-user-login-log/health.svg)

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

###  Alternatives

[akaunting/laravel-firewall

Web Application Firewall (WAF) package for Laravel

999465.8k2](/packages/akaunting-laravel-firewall)[cagilo/cagilo

A set of open-source Blade components for the Laravel Framework

172996.5k](/packages/cagilo-cagilo)[joaopaulolndev/filament-edit-profile

Filament package to edit profile

250258.1k34](/packages/joaopaulolndev-filament-edit-profile)[artmin96/filament-jet

This is my package filament-jet

481.2k](/packages/artmin96-filament-jet)

PHPackages © 2026

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