PHPackages                             adinaria/laravel-last-modified - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. adinaria/laravel-last-modified

ActiveLibrary[HTTP &amp; Networking](/categories/http)

adinaria/laravel-last-modified
==============================

Setting the Last-Modified header and 304 Not Modified response code if the page hasn't changed since the last visit, Work only with laravel 12

v1.0.0(9mo ago)017MITPHPPHP ^8.2

Since Aug 7Pushed 9mo agoCompare

[ Source](https://github.com/Adinaria/laravel-last-modified)[ Packagist](https://packagist.org/packages/adinaria/laravel-last-modified)[ Docs](https://github.com/adinaria/laravel-last-modified)[ RSS](/packages/adinaria-laravel-last-modified/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Last-Modified / 304 Not Modified Handler for Laravel
====================================================

[](#last-modified--304-not-modified-handler-for-laravel)

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

[ ![Packagist Version](https://camo.githubusercontent.com/68307c5779036cae12f9e8de8875f3cb3dfe85a88d5de7cb9f39ded67c2f8b1c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6164696e617269612f6c61726176656c2d6c6173742d6d6f646966696564)](https://packagist.org/packages/adinaria/laravel-last-modified "Packagist version")[ ![GitHub Tests Status](https://camo.githubusercontent.com/adf4e3e1c22d91aff371c20524fa51aac71a617b8a2a5249216d208465a9d192/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6164696e617269612f6c61726176656c2d6c6173742d6d6f6469666965642f74657374732e796d6c3f6c6162656c3d7465737473)](https://github.com/adinaria/laravel-last-modified/actions/workflows/tests.yml "GitHub Tests Status")[ ![GitHub Code Style Status](https://camo.githubusercontent.com/d0fdd1c24458f36b63e150b1c8b3d9046e10c40a4a00de03e953cb601c24de42/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6164696e617269612f6c61726176656c2d6c6173742d6d6f6469666965642f7068702d63732d66697865722e796d6c3f6c6162656c3d636f64652532307374796c65)](https://github.com/adinaria/laravel-last-modified/actions/workflows/php-cs-fixer.yml "GitHub Code Style Status")[ ![PHP Version Support](https://camo.githubusercontent.com/ab2968c474cd422fe0fda294bc18e2e788c3d1db2561dcd24f0862561e590203/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6164696e617269612f6c61726176656c2d6c6173742d6d6f646966696564)](https://www.php.net/ "PHP version")[ ![License](https://camo.githubusercontent.com/16a91071e4505f92b2c3302100e2aa4d34d8338a9c44d3bf43541cf5a6c7ceca/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6164696e617269612f6c61726176656c2d6c6173742d6d6f646966696564)](https://github.com/adinaria/laravel-last-modified/blob/master/LICENSE.md "License")

Requirements
------------

[](#requirements)

- PHP 7.4 - 8.3
- Laravel 8.x - 11.x

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require adinaria/laravel-last-modified
```

Optionally, you can publish the config file with:

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

Usage
-----

[](#usage)

The setup is very simple and consists of two steps:

### Registering middleware

[](#registering-middleware)

```
// in app/Http/Kernel.php

protected $middleware = [
    'web' => [
        // other middleware

        \Adinaria\LastModified\Middleware\LastModifiedHandling::class,
    ],
];
```

### Set Last Update Date in your Controller

[](#set-last-update-date-in-your-controller)

```
