2017 © Pedro Peláez
 

library login-activity

Track users login activity for Laravel 5

image

aginev/login-activity

Track users login activity for Laravel 5

  • Tuesday, June 26, 2018
  • by aginev
  • Repository
  • 1 Watchers
  • 1 Stars
  • 544 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 73 % Grown

The README.md

Track user login activity in Laravel 5

This package will subscribe for login and logout events and will log data into database or log files., (*1)

Features

  • Composer installable
  • PSR4 auto loading
  • Track user login
  • Track user logout
  • Write logs in database or log files
  • Command for cleaning logs

Requires

Build only for Laravel Framework 5 only!, (*2)

Installation

In terminal, (*3)

composer require aginev/login-activity:1.0.*

Add Service Provider to your config/app.php like so, (*4)

// config/app.php

'providers' => [
    '...',
    Aginev\LoginActivity\LoginActivityServiceProvider::class,
];

Publish migrations, (*5)

php artisan vendor:publish --provider="Aginev\LoginActivity\LoginActivityServiceProvider" --tag="migrations"
php artisan migrate

Optionally you can add login activity command and you will be able to clean your logs., (*6)

// app/Console/Kernel.php

protected $commands = [
    '...',
    \Aginev\LoginActivity\Commands\LoginActivityClean::class,
];

Optionally publish config, (*7)

php artisan vendor:publish --provider="Aginev\LoginActivity\LoginActivityServiceProvider" --tag="config"

Usage

Get logs, (*8)

$logs = \LoginActivity::getLogs()->get();

Get latest logs, (*9)

$logs = \LoginActivity::getLatestLogs(100); // number of logs to get or leave empty if you want to use the config value

Get login logs, (*10)

$logs = \LoginActivity::getLoginLogs()->get();

Get latest login logs, (*11)

$logs = \LoginActivity::getLatestLoginLogs(100); // number of logs to get or leave empty if you want to use the config value

Get logout logs, (*12)

$logs = \LoginActivity::getLogoutLogs()->get();

Get latest logout logs, (*13)

$logs = \LoginActivity::getLatestLogoutLogs(100); // number of logs to get or leave empty if you want to use the config value

Clean log, (*14)

$logs = \LoginActivity::cleanLog(30); // Offset in days

Clean the log from terminal, (*15)

php artisan login-activity:clean

Custom handler implmentations

  1. Implement \Aginev\LoginActivity\Handlers\LogActivityInterface in your custom handler.
  2. Place custom handler as value in login-activity.log config

Credits

https://github.com/spatie/activitylog, (*16)

License

MIT - http://opensource.org/licenses/MIT, (*17)

The Versions

26/06 2018

dev-master

9999999-dev http://aginev.com

Track users login activity for Laravel 5

  Sources   Download

MIT

by Atanas Ginev

login activity login activity for laravel 5 laravel 5 login activity

26/06 2018

1.0.2

1.0.2.0 http://aginev.com

Track users login activity for Laravel 5

  Sources   Download

MIT

by Atanas Ginev

login activity login activity for laravel 5 laravel 5 login activity

04/02 2016

v1.0.1

1.0.1.0 http://aginev.com

Track users login activity for Laravel 5

  Sources   Download

MIT

by Atanas Ginev

login activity login activity for laravel 5 laravel 5 login activity

04/02 2016

v1.0.0

1.0.0.0 http://aginev.com

Track users login activity for Laravel 5

  Sources   Download

MIT

by Atanas Ginev

login activity login activity for laravel 5 laravel 5 login activity