Download the PHP package ntimes/route-time-limits without Composer
On this page you can find all versions of the php package ntimes/route-time-limits. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ntimes/route-time-limits
More information about ntimes/route-time-limits
Files in ntimes/route-time-limits
Package route-time-limits
Short Description A Laravel package for limiting time spent on routes
License MIT
Informations about the package route-time-limits
๐ Laravel Route Time Limits
A Laravel package that allows you to set time limits on routes and track usage times based on user authentication status. This package helps you monitor and control how much time is spent on specific routes over a defined period, with different limits for authenticated and guest users.
๐ฅ Installation
Install the package via composer:
Publish the configuration and migrations:
Run the migrations:
๐ Usage
๐ฐ Basic Usage
Add the middleware to your routes:
โ๏ธ Configuration
You can customize the package behavior in the config/route_time_limits.php
file:
๐ ๏ธ Available Commands
๐งน Cleanup Old Records
The package includes a command to clean up old records:
This command is automatically scheduled to run daily, but you can also run it manually.
๐ Reset Time Limits
For testing or administrative purposes, you can reset time limits:
๐ How It Works
- When a user visits a route with the middleware applied, the package checks if there's an existing record for that route and user type (guest or authenticated).
- If no record exists, it creates one with the default time limit (or a custom one if configured).
- Each time the route is accessed, the time spent is tracked and added to the daily total.
- If the total time exceeds the configured limit, a 429 (Too Many Requests) response is returned.
- The time counter is reset daily.
- Different time limits are applied based on whether the user is authenticated or a guest.
- Guest users can be tracked by IP address if configured.
๐ License
The MIT License (MIT). Please see License File for more information.
All versions of route-time-limits with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/database Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/console Version ^8.0|^9.0|^10.0|^11.0|^12.0