Download the PHP package laragear/expire-route without Composer

On this page you can find all versions of the php package laragear/expire-route. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package expire-route

Expire Route

Latest Version on Packagist Latest stable test run Codecov Coverage Maintainability Sonarcloud Status Laravel Octane Compatibility

Never found models or objects past their expiration time.

Become a sponsor

Your support allows me to keep this package free, up-to-date and maintainable. Alternatively, you can spread the word!

Requirements

Installation

Just fire up Composer and require the package in your application

Usage

While Laravel Temporarily Protected Routes works great for making routes available for a given amount of time, this library uses your Eloquent Model in the route to expire it through a middleware.

To better understand how the middleware works, let's imagine we have the App\Models\Payment model with an expires_at attribute that determines when the payment should be become invalid. The expires middleware does this automatically: if the expires_at time is past, the request will be aborted with a HTTP 410 Gone code.

Multiple route parameters

By default, the middleware will always check for the last route parameter in a route. You may set the name of the parameter if you require to check its expiration time.

Custom attribute

If your model doesn't have an expires_at attribute to check, you can use dot.notation to traverse the object attributes and find the expiration time.

Relative expiration

When you have a model that doesn't have an expiration time, you can set a time in minutes (or a string to be parsed by strtotime()) to calculate from the created_at attribute when the route should expire.

For example, by setting 60, the route will expire once 60 minutes have passed since the creation of the App\Models\Payment model.

If you want to calculate the time from other attribute than created_at, issue the name of the attribute using dot.notation.

[!WARNING]

If the property or attribute doesn't exist or returns null, it will be assumed the model has not expired yet.

Using the routeExpiresAt() method

If the model or object implements the Laragear\ExpireRoute\Contracts\RouteExpirable contract, the routeExpiresAt() method will be used to retrieve the moment the route it should expire.

[!IMPORTANT]

Using the contract takes precedence, unless an attribute is specified by the middleware declaration itself.

Non Eloquent Models

Both middlewares are not limited to only Eloquent Models. It can be any object (even an array) that has a UNIX Epoch timestamp or a datetime, since the check is done by retrieving the value through data_get() and then parsed by Laravel's Date Factory.

Fluent middleware declaration

You may also use the Laragear\ExpireRoute\Http\Middleware\Expires middleware to fluently configure it in your route. It's a great way to set relative time expressively.

Laravel Octane compatibility

There should be no problems using this package with Laravel Octane.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

This specific package version is licensed under the terms of the MIT License, at time of publishing.

Laravel is a Trademark of Taylor Otwell. Copyright © 2011-2025 Laravel LLC.


All versions of expire-route with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version 11.*|12.*
illuminate/http Version 11.*|12.*
illuminate/routing Version 11.*|12.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package laragear/expire-route contains the following files

Loading the files please wait ....