PHPackages                             tinigin/laravel-etag - 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. tinigin/laravel-etag

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

tinigin/laravel-etag
====================

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

1.0.5(3mo ago)0267↓77.3%MITPHPPHP ^8.3CI passing

Since Mar 31Pushed 3mo agoCompare

[ Source](https://github.com/tinigin/laravel-etag)[ Packagist](https://packagist.org/packages/tinigin/laravel-etag)[ Docs](https://github.com/tinigin/laravel-etag)[ RSS](/packages/tinigin-laravel-etag/feed)WikiDiscussions main Synced 4w ago

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

ETag / 304 Not Modified Handler for Laravel
===========================================

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

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

[ ![Packagist Version](https://camo.githubusercontent.com/d004dd140e699d76c6a4650901c28e7dd37a7faa5a58a9d7051dc105fb9a5f7c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74696e6967696e2f6c61726176656c2d65746167)](https://packagist.org/packages/tinigin/laravel-etag "Packagist version")[ ![GitHub Tests Status](https://camo.githubusercontent.com/aa7d5daf8aba1f769fe9d4a59297bbc130325755ba69562d2bac192ee7acb2b3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f74696e6967696e2f6c61726176656c2d657461672f74657374732e796d6c3f6c6162656c3d7465737473)](https://github.com/tinigin/laravel-etag/actions/workflows/tests.yml "GitHub Tests Status")[ ![GitHub Code Style Status](https://camo.githubusercontent.com/edf5e38af7b2714515c69a7fdde89211be5c084f8614acd32d80e234e0152ddb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f74696e6967696e2f6c61726176656c2d657461672f7068702d63732d66697865722e796d6c3f6c6162656c3d636f64652532307374796c65)](https://github.com/tinigin/laravel-etag/actions/workflows/php-cs-fixer.yml "GitHub Code Style Status")[ ![PHP Version Support](https://camo.githubusercontent.com/effd0e1337900a78a277049eabe5621353e598d218196ea329cd01b9d513e27e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f74696e6967696e2f6c61726176656c2d65746167)](https://www.php.net/ "PHP version")[ ![License](https://camo.githubusercontent.com/bec9f31be78a147693f074d236be64003ba49145ac0c27b9b055304f7f37758b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f74696e6967696e2f6c61726176656c2d65746167)](https://github.com/tinigin/laravel-etag/blob/master/LICENSE.md "License")

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

[](#requirements)

- PHP 8.3+
- Laravel 11.x / 12.x / 13.x

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

[](#installation)

You can install the package via composer:

```
composer require tinigin/laravel-etag
```

Optionally, you can publish the config file with:

```
php artisan vendor:publish --tag="etag-config"
```

Usage
-----

[](#usage)

The setup is very simple and consists of two steps:

### Registering middleware

[](#registering-middleware)

```
// in bootstrap/app.php

->withMiddleware(function (Middleware $middleware) {
    $middleware->web(append: [
        \Tinigin\ETag\Middleware\ETagHandling::class,
    ]);
})
```

### Set Last Update Date in your Controller

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

```
