Audit login is a another package for laravel framework. The purpose is to auditing login events
fikrimastor/audit-login is a Laravel package for audit login is a another package for laravel framework. the purpose is to auditing login events.
It currently has 0 GitHub stars and 13 downloads on Packagist (latest version v1.1.1).
Install it with composer require fikrimastor/audit-login.
Discover more Laravel packages by fikrimastor
or browse all Laravel packages to compare alternatives.
Last updated
Audit login is another package for Laravel framework. The purpose is auditing login events
You can install the package via composer:
composer require fikrimastor/audit-login
You can publish and run the migrations with:
php artisan vendor:publish --tag="audit-login-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="audit-login-config"
This is the contents of the published config file:
return [
'enabled' => env('AUDIT_LOGIN_ENABLED', true),
'drivers' => [
'database' => [
'table' => env('AUDIT_LOGIN_DATABASE_TABLE', 'audit-logins'),
'connection' => env('AUDIT_LOGIN_DATABASE_CONNECTION', 'mysql'),
],
],
...
];
If you want to custom some actions, for example, while user login, you want to send an email notification, you may create new service provider and defined it in config/app.php.
So, under the new service provider, under the boot method, you can do something like this:
use \FikriMastor\AuditLogin\Facades\AuditLogin;
use \YourProjectNamespace\YourCustomLoginEventClass;
public function boot(): void
{
AuditLogin::recordLoginUsing(YourCustomLoginEventClass::class);
}
And then, you can create a new class for your custom login event action class, for example:
use \FikriMastor\AuditLogin\Contracts\LoginEventContract;
class YourCustomLoginEventClass implements LoginEventContract
{
public function handle(object $event, AuditLoginAttribute $attributes): void
{
AuditLogin::auditEvent($event, $attributes);
// Do something here
// Send email notification
}
}
The event object consists of the user object logged in, and the attribute object is the object that contains the login event attributes.
Some of it use Authenticatable contract, so you can use it to get the user data.
You may learn about Auth events in Laravel here.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.