mretaa/laravel-auto-logout

Laravel Auto Logout is a Laravel package that automatically manages the logout of inactive users. It includes a Tailwind CSS modal that appears before logout to allow the user to end or extend their session.

Installs: 297

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/mretaa/laravel-auto-logout

v1.0.0 2025-09-19 11:27 UTC

This package is not auto-updated.

Last update: 2026-01-24 12:08:10 UTC


README

Laravel Auto Logout is a Laravel package that automatically manages the logout of inactive users. It includes a Tailwind CSS modal that appears before logout to allow the user to end or extend their session.

✨ Features

  • Automatic logout after a period of inactivity (configurable).
  • Display of a Tailwind modal asking if the user wants to stay logged in.
  • Configurable countdown before logout.
  • Simple integration with a Blade @autoLogout directive.
  • Middleware to enhance server-side security.

📦 Installation

Install via Composer:

composer require mretaa/laravel-auto-logout

⚙️ Configuration

Publish configuration files, views, and public assets:

php artisan vendor:publish --provider=“Mretaa\AutoLogout\IdleGuardServiceProvider”

This will create:

  • config/idle-guard.php (package configuration)

  • resources/views/vendor/auto-logout/ (modal view)

  • public/vendor/auto-logout/js/ (JS script)

Configuration example (config/idle-guard.php)

<?php

    return [
        ‘idle_time’   => 300,     // Time (seconds) before displaying the modal
        ‘logout_time’ => 60,      // Time (seconds) after modal before logging out
        ‘redirect_url’ => ‘/logout’, // Redirect URL after logging out
    ];