PHPackages                             sentinel-dvlpr/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. sentinel-dvlpr/laravel-last-modified

ActiveLibrary

sentinel-dvlpr/laravel-last-modified
====================================

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

v1.1.0(5mo ago)018MITPHPPHP ^8.2

Since Nov 17Pushed 5mo agoCompare

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

READMEChangelogDependencies (6)Versions (3)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/cffbad38a518baa6ab40497af5a815223e73bb5a67b40c5bb897cdc274b519f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61626f72646167652f6c61726176656c2d6c6173742d6d6f646966696564)](https://packagist.org/packages/abordage/laravel-last-modified "Packagist version")[ ![GitHub Tests Status](https://camo.githubusercontent.com/61cf9e38ce8cb9afe6c05e116854a6782af6f3d968c74eefeeffe6bcd0b17b41/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61626f72646167652f6c61726176656c2d6c6173742d6d6f6469666965642f74657374732e796d6c3f6c6162656c3d7465737473)](https://github.com/abordage/laravel-last-modified/actions/workflows/tests.yml "GitHub Tests Status")[ ![GitHub Code Style Status](https://camo.githubusercontent.com/56a021006ff84d6f368bfc8fa825ab79d47178060f07d518c85c6788188d5cbe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61626f72646167652f6c61726176656c2d6c6173742d6d6f6469666965642f7068702d63732d66697865722e796d6c3f6c6162656c3d636f64652532307374796c65)](https://github.com/abordage/laravel-last-modified/actions/workflows/php-cs-fixer.yml "GitHub Code Style Status")[ ![PHP Version Support](https://camo.githubusercontent.com/0608de4b5cdf09dbea1a6349ed7a1ed73088e3836d40b3af1e14ef53b717d76e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f61626f72646167652f6c61726176656c2d6c6173742d6d6f646966696564)](https://www.php.net/ "PHP version")[ ![License](https://camo.githubusercontent.com/29e905d17573b1d7b68b95956d45741fceeeb672110b5c19859763274a1cea15/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f61626f72646167652f6c61726176656c2d6c6173742d6d6f646966696564)](https://github.com/abordage/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 abordage/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

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

### Set Last Update Date in your Controller

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

```
