New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

abordage/laravel-last-modified

Setting the Last-Modified header and 304 Not Modified response code if the page hasn't changed since the last visit
20,476 12

Larablocks Analysis

abordage/laravel-last-modified works with Laravel 11, 12 and 13 (latest release 1.1.0, Oct 20, 2026).

Laravel 8, 9 and 10 in earlier releases.

Promising: maintained and up to date, meets 2 of 4 checks; not yet widely used.

  • Works with Laravel 13, the current version
  • Released in the last 12 months (Oct 20, 2026)
  • 717 downloads a month (needs 10,000)
  • 12 GitHub stars (needs 100)

State

Maintained
  • Last stable release: Oct 20, 2026.
  • 2 releases in the last 12 months.
  • First released: Jun 10, 2022.
  • Monthly downloads: 717.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 29, 2026.

Install
composer require abordage/laravel-last-modified
Latest Version:1.1.0
PHP:^8.2
Laravel:11 · 12 · 13
Older releases:8 · 9 · 10
License:MIT
Last Updated:Oct 20, 2026
Links: GitHub  ·  Packagist
Maintainer: abordage

Last-Modified / 304 Not Modified Handler for Laravel

Easily setting the Last-Modified header and 304 Not Modified response code.

Packagist Version GitHub Tests Status GitHub Code Style Status PHP Version Support License

Requirements

  • PHP 8.2+
  • Laravel 12.x / 13.x

Installation

You can install the package via composer:

composer require abordage/laravel-last-modified

Optionally, you can publish the config file with:

php artisan vendor:publish --tag="last-modified-config"

Usage

The setup is very simple and consists of two steps:

Registering middleware

// in bootstrap/app.php

->withMiddleware(function (Middleware $middleware) {
    $middleware->web(append: [
        \Abordage\LastModified\Middleware\LastModifiedHandling::class,
    ]);
})

Set Last Update Date in your Controller

<?php
 
namespace App\Http\Controllers;
 
use App\Http\Controllers\Controller;
use LastModified;
 
class PostController extends Controller
{
    public function show($id)
    {
        $post = \App\Models\Post::findOrFail($id);

        LastModified::set($post->updated_at);
        
        return view('posts.show', ['post' => $post]);
    }
}

It's all. Now you can check the headers.

How to check headers

You can check headers in the browser console under the Network tab (make sure Disable Cache is off)

or

using https://last-modified.com/en

Check Last-Modified

Testing

composer test:all

or

composer test:phpunit
composer test:phpstan
composer test:phpcsf

or see https://github.com/abordage/laravel-last-modified/actions/workflows/tests.yml

Feedback

If you have any feedback, comments or suggestions, please feel free to open an issue within this repository.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

expertsystemsau/laravel-conditional-requests

HTTP conditional requests for Laravel — ETag, Last-Modified, 304 Not Modified, a...

1,875 0
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607

Version History

Version Released PHP Laravel License
1.1.0 ^8.2 ^11.0 || ^12.0 || ^13.0 MIT
1.0.0 ^8.2 ^11.0 || ^12.0 MIT
0.2.1 >=7.4 ^8.0 || ^9.0 || ^10.0 || ^11.0 MIT
0.2.0 >=7.4 ^8.0 || ^9.0 || ^10.0 MIT
0.1.4 >=7.4 ^8.0 || ^9.0 MIT