PHPackages                             biscolab/laravel-authlog - 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. biscolab/laravel-authlog

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

biscolab/laravel-authlog
========================

User's authentication log package for Laravel

0.2.0(6y ago)3282MITPHPPHP ^7.1CI failing

Since Sep 25Pushed 6y agoCompare

[ Source](https://github.com/biscolab/laravel-authlog)[ Packagist](https://packagist.org/packages/biscolab/laravel-authlog)[ Docs](https://biscolab.com/laravel-authlog)[ RSS](/packages/biscolab-laravel-authlog/feed)WikiDiscussions release/v0 Synced today

READMEChangelog (4)Dependencies (3)Versions (4)Used By (0)

Laravel Auth-log
================

[](#laravel-auth-log)

User authentication log for Laravel 5, 6 and 7. This package allows you to log user's authentication and force its logout if necessary!

**This package is still unstable. Please report any bug`and documentation lack in order to fix that promptly**.

Thanks for your help.

System requirements
-------------------

[](#system-requirements)

Set `session.driver` value

> To use this package the only allowed values of `session.driver` are `file`, `database`, `redis` (at the moment).

Install
-------

[](#install)

You can install the package via composer:

```
$ composer require biscolab/laravel-authlog
```

Laravel 5.5 (or greater) uses package auto-discovery, so doesn't require you to manually add the Service Provider, but if you don't use auto-discovery `AuthLogServiceProvider` must be registered in `config/app.php`:

```
'providers' => [
    ...
    Biscolab\LaravelAuthLog\AuthLogServiceProvider::class,
];
```

You can use the facade for shorter code. Add `AuthLog` to your aliases:

```
'aliases' => [
    ...
    'AuthLog' => Biscolab\LaravelAuthLog\Facades\AuthLog::class,
];
```

Publish package
---------------

[](#publish-package)

Publish configuration and migration files using the following artisan command:

```
$ php artisan vendor:publish --provider="Biscolab\LaravelAuthLog\AuthLogServiceProvider"
```

Configuration
-------------

[](#configuration)

Edit `config/authlog.php`

Variable nameTypeDescriptionDefault value`safe_mode``bool`Avoid to force logout by yourself`true``enabled``bool`If `true` the package is active and user's authentication will be logged`true``skip_ip``string`A whitelist of IP addresses (CSV format) that, if recognized, disable the package`''``table_name``string`The name of the AuthLog database table`authlog``users_table_size``string`Users table size in order to add foreign keys (`int` means INT, `big` means BIGINT). Since Laravel 5.8, value should be `big` (\*)`big``authlog_model``string`AuthLog class. You can change ìt **BUT** your custom class **MUST** implements `'Biscolab\LaravelAuthLog\Models\AuthLogInterface'``'Biscolab\LaravelAuthLog\Models\AuthLog'``session_model``string`Session class. You can change ìt **BUT** your custom class **MUST** implements `'Biscolab\LaravelAuthLog\Models\SessionInterface'``'Biscolab\LaravelAuthLog\Models\Session'``session_auth_log_id_key``string`Session key used to store your AuthLog ID`'auth_log_id'``add_auth_log_id_to_ajax_response``bool`If `true` AuthLog ID will be added to your AJAX responses`true``ajax_response_auth_log_id_name``string`AJAX response key used to send your AuthLog ID`'auth_log_id'``add_auth_log_id_header_to_http_response``bool`If `true` AuthLog ID will be added to your response headers`true``auth_log_id_header_nameauth_log_id_header_name``string`AuthLog ID header name`'X-Auth-Log-Id'`> Remember to run the `php artisan config:cache` command

> (\*) If you are using a custom `users` table please edit `datatbase/migratons/2019_09_19_000000_create_authlog_table.php` after run `vendor:publish` artisan command and before run `migration` artisan command

Add `AuthLoggable` trait to `User` model
----------------------------------------

[](#add-authloggable-trait-to-user-model)

Use `Biscolab\LaravelAuthLog\Traits\AuthLoggable` in `App\User`

```
