PHPackages                             mahfuz/login-activity - 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. [Security](/categories/security)
4. /
5. mahfuz/login-activity

ActiveLibrary[Security](/categories/security)

mahfuz/login-activity
=====================

This package will save login and logout activity of user

421.1k↓50%PHP

Since Jun 27Pushed 7y ago1 watchersCompare

[ Source](https://github.com/git-mahfuz/login-activity)[ Packagist](https://packagist.org/packages/mahfuz/login-activity)[ RSS](/packages/mahfuz-login-activity/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Login Activity
======================

[](#laravel-login-activity)

##### This package will save successful login, failed login attempt and logout activity of user

[](#this-package-will-save-successful-login-failed-login-attempt-and-logout-activity-of-user)

###### Features:

[](#features)

- Logging Successful Login Event with IP and User Agent Information.
- Logging Logout Event with IP and User Agent Information.
- Logging Failed Login Events with IP and User Agent Information.
- Sending Email to User Upon Multiple Failed Login Attempts to Their Account On a Certain Time Interval to let them know about suspicious activity in their account.

Installation instructions for Laravel 5.3.\*
--------------------------------------------

[](#installation-instructions-for-laravel-53)

Considering `user_id` as your `primary column` of `users` table follow below steps to install this package -

##### 1. Installation

[](#1-installation)

Install the package by running below command in your terminal -

`composer require mahfuz/login-activity:dev-master`

##### 2. Adding Servicer Provider to Providers Array

[](#2-adding-servicer-provider-to-providers-array)

Add below Service Provider in your `providers` array of `config/app.php` file

`Mahfuz\LoginActivity\LoginActivityServiceProvider::class,`

##### 3. Running Migrations

[](#3-running-migrations)

Run `php artisan migrate` in your terminal. This will run a migration file required to make this project work which will create a table name `login_activities` in your database.

##### 4. Adding Event Listeners

[](#4-adding-event-listeners)

Add below event listeners to `$listen` array of `app/Providers/EventServiceProvider.php`

```
'Illuminate\Auth\Events\Login' => [
    'Mahfuz\LoginActivity\Listeners\LogSuccessfulLogin',
],

'Illuminate\Auth\Events\Failed' => [
    'Mahfuz\LoginActivity\Listeners\LogFailedLogin',
],

'Illuminate\Auth\Events\Logout' => [
    'Mahfuz\LoginActivity\Listeners\LogSuccessfulLogout',
],

```

##### 5. Accessing Routes and Views

[](#5-accessing-routes-and-views)

To view login activities visit this URL `http://localhost:8000/login-activity`.

\*\*\* Please note that `url('login-activity')` is protected by `auth` middleware. So, only logged in user can able to browse this route path.

##### 6. Publishing Views, Migrations and Config files

[](#6-publishing-views-migrations-and-config-files)

Go to your project root via terminal and run `php artisan vendor:publish`

Once done check `config/login-activity.php`, you can configure it to whether send email upon 'X' failed login attempts in last 'N' minutes or not.

Also check `resources/views/vendor/login-activity` if you want to update login activity view and failed login attempt email view.

That's all.

##### Sample View:

[](#sample-view)

[![Alt text](sample-view.png?raw=true "Login Activities")](sample-view.png?raw=true)

##### Happy Coding!

[](#happy-coding)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9789401?v=4)[Mahfuzul Alam](/maintainers/git-mahfuz)[@git-mahfuz](https://github.com/git-mahfuz)

---

Top Contributors

[![git-mahfuz](https://avatars.githubusercontent.com/u/9789401?v=4)](https://github.com/git-mahfuz "git-mahfuz (7 commits)")

### Embed Badge

![Health badge](/badges/mahfuz-login-activity/health.svg)

```
[![Health](https://phpackages.com/badges/mahfuz-login-activity/health.svg)](https://phpackages.com/packages/mahfuz-login-activity)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41478.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

87117.5M63](/packages/bjeavons-zxcvbn-php)[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)[paragonie/hidden-string

Encapsulate strings in an object to hide them from stack traces

7410.6M39](/packages/paragonie-hidden-string)

PHPackages © 2026

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