Download the PHP package spargon/laravel-auth-logger without Composer

On this page you can find all versions of the php package spargon/laravel-auth-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-auth-logger

GitHub release GitHub issues Total Downloads StyleCI

Laravel Auth Logger stores user authentication logs and sends out notifications whenever a user logs in from a new system.

Installation

Laravel Auth Logger requires PHP 7.0+ and currently supports Laravel 7, 8 & 9.

You can install the package via composer:

After installing the Laravel-Auth-Logger package, you need run the install command which will take care of everything you need to get started. Type the following artisan command in your console:

This will publish the config/auth-logger.php file, publish the necessary migration files and ask you for permission to run said migrations.

Once installed, you need to add the AuthLogable and Notifiable traits to your authenticatable model (by default its, App\Models\User model). These traits provides you with various methods to get the data generated by the auth logger, such as last login time, last login IP address, and sets the channels to notify the user when they login from a new device:

Usage

Get all the authentication logs for a user:

Get the user's last login info (includes the current session if the user is logged in):

Get the user's previous login time & ip address (ignoring the current login log):

Send New Device Alert Notification

Notifications may be sent on the mail, or/and the slack channels. By default AuthLogger will send a notification via the mail driver (provided you have enabled notify in config/auth-logger.php file).

You can define notifyAuthLoggerVia method on the User's Model to determine which channels the notification should be sent to:

Slack Notifications & Customiziations

Note: If you want to use the slack notification channel, you need to install the laravel/slack-notification-channel package first otherwise your app will throw a Driver not supported error. Be sure to go through the Laravel docs for Slack Pre-requisites here.

You also need to generate a Slack Incoming Webhook from here and then add the generated webhook to your authenticatable model (usually the User) as such:

Customizing Messages

In config/auth-logger.php file, you can customize the name of the Sender, the Channel to receive the notifications on & the Icon to show on the notification.

By default all slack messages will be sent to the #general channel. Slack Sample Image Mail Sample Image

Disabling Notifications

Of course you can disable notifications by setting the notify option in your config/auth-logger.php configuration file to false:

User Agent Parser

This package uses the jenssegers/agent package to parse the user's user-agent when sending the alert notification. Take a look at their docs here to learn how to use it in your app (ex: in your logs table).

Delete logs after a while

You may clear the old authentication log records using the auth-logger:clear Artisan command:

php artisan auth-logger:clear

Records that are older than the number of days specified in the older option in your config/auth-logger.php will be deleted when you run the above command:

Optional Files

You can publish the New Device Alert Email view using the command below:

You can also publish the translations file used by the auth-logger using the command below:

These are optional files. You don't need to publish them for the package to work. They exist only for cases where you want to make any changes to the files yourself.

Change Database Table Name

If you want to change the name of the auth-logger table, you can do so by changing the vaule of table_name in the config/auth-logger.php file (this step is optional - you must also update the table name in the migrations/database to reflect the same).

Experimental (dev-geoip)

Currently we are experimenting with an implention of Location Tagging (using GeoIP package from Torann). You can checkout the geoip branch to play around with it or get the dev-geoip release from packagist using composer require spargon/laravel-auth-logger:dev-geoip

This is an experimental release of location tagging. Accuracy is not 100% guaranteed. Use it at your own risk. PS> This experimental version does not contain the install command.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-auth-logger with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
jenssegers/agent Version ^2.6
illuminate/auth Version ^7.30.4|^8.40.0|^9.0|^10.0|^11.0
illuminate/bus Version ^7.30.4|^8.40.0|^9.0|^10.0|^11.0
illuminate/console Version ^7.30.4|^8.40.0|^9.0|^10.0|^11.0
illuminate/contracts Version ^7.30.4|^8.40.0|^9.0|^10.0|^11.0
illuminate/database Version ^7.30.4|^8.40.0|^9.0|^10.0|^11.0
illuminate/http Version ^7.30.4|^8.40.0|^9.0|^10.0|^11.0
illuminate/notifications Version ^7.30.4|^8.40.0|^9.0|^10.0|^11.0
illuminate/support Version ^7.30.4|^8.40.0|^9.0|^10.0|^11.0
spatie/laravel-package-tools Version ^1.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package spargon/laravel-auth-logger contains the following files

Loading the files please wait ....