esplora/auto-login

Enables seamless autologin functionality via temporary links, providing convenient and secure access to your application.
2,595 4
Install
composer require esplora/auto-login
Latest Version:1.0.0
License:MIT
Last Updated:Jun 15, 2026
Links: GitHub  ·  Packagist
Maintainer: tabuna

Auto Login for Laravel

The AutoLogin package for Laravel enables seamless autologin functionality via temporary links. Empower your users with convenient access to your application by securely logging them in using time-limited, temporary autologin links.

Installation

You can install AutoLogin in your project using the Composer package manager:

composer require esplora/auto-login

Usage

To get started with the AutoLogin package, follow the steps below:

  1. Add the route for autologin in your routes/web.php file:
use Esplora\AutoLogin\AutoLogin;

AutoLogin::routes();

This will register the necessary route for autologin functionality.

  1. Create temporary autologin links in your controllers, emails, or other relevant places using the following methods:
AutoLogin::to('/path');
// or use named routes
AutoLogin::route('telescope', [
    'active' => '1'
]);

These methods will generate temporary links that automatically log in the user. By default, the current authenticated user will be used. However, if the code is executed in the console or in a non-authenticated context, you need to pass the user ID as the second argument:

AutoLogin::to('/path', 123);
// or use named routes
AutoLogin::route('telescope', [
    'active' => '1'
], 123);

Configuration

The AutoLogin package provides some configuration options to suit your needs. By default, the autologin URL is set to /autologin. However, if you have changed this route usage, you can specify the desired URL using the following method:

use Esplora\AutoLogin\AutoLogin;

AutoLogin::routes('/your/path/autologin');

Additionally, you can specify a Blade template to customize the autologin view. Simply pass the desired template path as the second argument:

use Esplora\AutoLogin\AutoLogin;

AutoLogin::routes('/your/path/autologin', 'path.for.your.blade.template');

In your custom template, you can access the link variable, which contains the autologin URL, and use it as needed.

<!-- path.for.your.blade.template -->

<!doctype html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Redirecting...</title>

    <script type="text/javascript">
      setTimeout(function () {
        window.location.href = "{{ $link }}";
      }, 3000);
    </script>
  </head>
  <body>
    <h1>You are being redirected</h1>

    <p>You will be redirected to an external page in a few seconds.</p>

    <p>
      If you are not redirected automatically, please click
      <a href="https://github.com/esplora/auto-login/blob/HEAD/{{ $link }}">here</a>.
    </p>
  </body>
</html>

License

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

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

637,827,751 9,703
laravel/framework

The Laravel Framework.

589,172,971 34,950
laravel/tinker

Powerful REPL for the Laravel framework.

498,216,183 7,442
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

413,412,504 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

391,429,217 4,660