This document explains how to set up session expiry management in the Laravel APM application.
Add the following to your .env file:
# CI Application Configuration
CI_BASE_URL=http://localhost/staff
Ensure your session configuration in config/session.php is properly set:
'lifetime' => env('SESSION_LIFETIME', 120), // 2 hours in minutes
The session expiry middleware is already registered in bootstrap/app.php:
$middleware->web(append: [
\App\Http\Middleware\CheckSessionExpiry::class,
]);
The following endpoints have been added to the CI application:
GET /api/validate-session - Validates session tokenPOST /api/refresh-token - Refreshes session tokenThe following endpoints are available in the Laravel app:
GET /api/validate-session - Validates session with CI appPOST /api/extend-session - Extends current sessionGET /api/session-status - Gets current session statusTo change the warning time (default: 5 minutes), modify the warningTime property in public/js/session-monitor.js:
this.warningTime = 5 * 60; // 5 minutes in seconds
To change the check interval (default: 30 seconds), modify the checkInterval property:
this.checkInterval = 30; // Check every 30 seconds
To change the session lifetime, update the SESSION_LIFETIME environment variable:
SESSION_LIFETIME=180 # 3 hours in minutes
user-logged-in)app/Http/Middleware/CheckSessionExpiry.php - Session expiry middlewareapp/Http/Controllers/Api/SessionController.php - Session management APIresources/views/components/session-expiry-modal.blade.php - Warning modalspublic/js/session-monitor.js - Client-side session monitoringresources/views/layouts/app.blade.php - Updated to include componentsroutes/web.php - Added API routesbootstrap/app.php - Registered middlewareconfig/app.php - Added CI base URL configurationapplication/modules/share/controllers/Share.php - Added session validation endpoints