Download the PHP package delickate/user-sessions without Composer
On this page you can find all versions of the php package delickate/user-sessions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download delickate/user-sessions
More information about delickate/user-sessions
Files in delickate/user-sessions
Package user-sessions
Short Description Laravel package to log user login/logout sessions
License MIT
Informations about the package user-sessions
User Sessions
User Sessions is a Laravel package for tracking user activity, managing user sessions, and logging detailed session and request data. It is designed to enhance auditing, analytics, and security in your Laravel applications.
📦 Installation
Install the package via Composer:
Or install the latest development version:
Pushlish files
Remove / Uninstall
To uninstall the package:
Clear Laravel caches after installation/removal:
After installing, run the migrations to create required database tables:
Middleware
Add the user sessions middleware in your app/Http/Kernel.php under the web middleware group (after authentication middleware):
1) \App\Http\Middleware\SecurityHeaders::class inside middleware array 2) 'user.sessions' inside middlewareGroups array
This middleware automatically logs user activity and stores session information & will provide security protections.
Routes
Models
Open User model and add 'password_changed_at' in fillable like this
Exception handler
Open App\Exceptions\Handler.php file and update it like this
Layout links
Publish Package Files
Publish all package configuration, views, routes, controllers, and middleware:
⚡ Features
User Sessions package provides the following features:
1. User Session Tracking
- Automatically tracks user sessions.
- Stores session ID, login/logout times, and session metadata.
- Supports multiple simultaneous sessions per user.
2. Activity Logging
Logs each user request, including:
- HTTP method (GET, POST, etc.)
- URL and route name
- Payload (excluding sensitive data like passwords)
- IP address and user agent
- Timestamp of the request
- Payload is stored safely as JSON in the database.
3. Audit Logging
- Tracks database changes for configured models.
- Logs UPDATE and DELETE queries automatically.
- Prevents logging of system tables to avoid infinite loops.
- Supports model observers for detailed audit trails.
4. Login & Logout Event Listeners
- Logs every user login and logout event.
- Automatically associates events with user session records.
5. Middleware-Based Architecture
- user.sessions middleware handles request logging.
- store.user.session middleware stores session IDs for the currently logged-in user.
- Easy to customize or extend.
6. Customizable Views & Routes
- Optional UI for viewing user sessions and activity.
- Configurable routes and views.
- Fully publishable for customization.
7. Secure & Lightweight
- Excludes sensitive fields (passwords, tokens) from logs.
- Minimal overhead and fully compatible with Laravel's session system
- Clickjacking Protection (Prevents the application from being embedded in iframe elements on external domains)
- MIME-Type Sniffing Prevention (Prevents browsers from interpreting files as a different MIME type than declared)
- Cross-Site Scripting (XSS) Protection (Legacy Browsers)
- Referrer Policy Enforcement (Controls how much referrer information is shared during navigation)
- Content Security Policy (Restricts the sources from which the browser may load resources)
-
HTTP Strict Transport Security (Forces browsers to use HTTPS for all future requests)
8. Password Policy & Authentication Controls
- Strong password complexity enforcement
- Password history restriction (reuse prevention)
- Forced password change mechanisms
- 90-day password expiration enforcement
- Secure password storage using strong hashing
- Administrative forced reset capability
This version includes:
- Installation & uninstall instructions
- Middleware setup
- Publishing files
- Detailed feature list
- Configuration & usage examples
- Troubleshooting
- License & contributing info
Here is list of commands in order to run
To remove package run following commands