Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Last Modified

Last Modified Laravel Package

andrey-helldar/last-modified

Laravel package that adds HTTP Last-Modified headers to responses, helping browsers and proxies cache pages efficiently and validate freshness via conditional requests. Simple middleware integration for smarter caching and fewer redundant requests in Laravel apps.

View on GitHub
Deep Wiki
Context7

Setting the response code 304 Not Modified in the absence of content changes.

Frequently asked questions about Last Modified
What does the andrey-helldar/last-modified package do?
It is a Laravel package that adds HTTP Last-Modified headers to responses and sets the 304 Not Modified status code when the content has not changed. This lets browsers and proxies validate cached pages with conditional requests, reducing redundant full responses. It is intended for simple middleware-based caching improvements in Laravel applications.
How do I install andrey-helldar/last-modified in a Laravel app?
Install it with Composer using composer require andrey-helldar/last-modified. Laravel package discovery registers the service provider automatically, so you normally do not need to add it to config/app.php. Then attach the package middleware to the routes or groups where you want Last-Modified handling. Check the package README for the exact middleware class and registration syntax.
How does the package decide when to return 304 Not Modified?
It works with the HTTP Last-Modified response header and conditional request headers such as If-Modified-Since. When the client's cached version is still fresh and the content has not changed, the middleware returns 304 Not Modified instead of sending the full response body. This is the standard HTTP freshness validation flow used by browsers and shared proxies.
Which Laravel versions does andrey-helldar/last-modified support?
Release 4.4.0 adds declared support for Laravel 13 by widening the illuminate dependency constraints. Earlier Laravel versions remain supported according to the package's composer.json range. If you are on Laravel 12 or below, 4.4.0 is described as a drop-in from 4.3.x. Always confirm the exact constraint in Composer before upgrading.
Do I need to publish config or run migrations after installing last-modified?
No database migrations are involved, and the 4.4.0 release introduces no new config keys, container bindings, or public APIs. Integration is primarily Composer installation plus middleware registration. Any optional configuration should be confirmed in the README for your installed version.
Can last-modified reduce redundant requests in a Laravel application?
Yes. By sending Last-Modified and honoring conditional requests, the package lets clients reuse cached representations and avoid downloading unchanged content. That can reduce bandwidth and server work for cacheable pages. It is not a full response cache, so pair it with appropriate cache headers and proxy or CDN caching where needed.
Is upgrading from 4.3.x to 4.4.0 safe?
The 4.4.0 release is compatibility-only, with Laravel 13 support as the sole functional change listed. Risk is low, but you should run composer update andrey-helldar/last-modified --with-dependencies in a branch, inspect the lockfile diff, and run your test suite. Treat Laravel 13 support as a vendor claim until you validate it in your own environment.
Does this package really work with Laravel 13?
Version 4.4.0 declares Laravel 13 compatibility through its Composer constraints. The package notes do not confirm an upstream CI matrix proving Laravel 13 passes, so validate with your own regression run before relying on it in production. If Laravel 13 is still pre-release for your team, stay pinned to a known-good version.
How should I test Last-Modified and 304 responses in Laravel?
Write a feature test that requests a route with the package middleware and asserts the Last-Modified header is present. Then send a second request with an If-Modified-Since header matching that timestamp and assert a 304 status with an empty body. Also smoke test any routes where caching behavior could affect authentication or personalized content.
What are alternatives to andrey-helldar/last-modified for HTTP caching in Laravel?
You can implement Last-Modified and ETag handling with custom middleware, use Laravel's response caching features, or rely on reverse proxy and CDN cache configuration. Some teams prefer a full response cache package when they need stored page output rather than conditional validation. Choose based on whether you need lightweight 304 validation or broader cache storage.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager