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

dragon-code/last-modified

A small Laravel package for tracking last-modified timestamps and exposing them through HTTP headers, helping browsers, proxies, and caches avoid unnecessary re-downloads and stay in sync with your content.

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
How do I install dragon-code/last-modified in a Laravel application?
Install it with composer require dragon-code/last-modified. There are no migrations and no service-provider state to manage; the package is a lightweight middleware layer. After installing, register the middleware globally in the HTTP kernel or on the specific route group that serves cacheable content.
How does the package return a 304 Not Modified response?
It sets a Last-Modified header on responses and inspects the incoming If-Modified-Since request header. When the client's timestamp is not older than the computed last-modified date, the middleware short-circuits with 304 Not Modified and an empty body. That saves bandwidth and avoids re-sending unchanged content.
Where should I register the Last-Modified middleware in Laravel?
Register it globally in the HTTP kernel for site-wide coverage, or attach it to a read-heavy route group such as public content or API GET endpoints. Because a 304 response short-circuits the remaining pipeline, place it after authentication and authorization middleware when responses depend on permissions. Verify route-level middleware ordering in your app before relying on it.
Which Laravel versions does dragon-code/last-modified support?
The 4.4.0 release updates the package to target Laravel 13, so it is tracking current framework majors. Check the composer.json constraint against your pinned Laravel minor before upgrading. Also confirm that the project's CI matrix actually exercises your version, because a compatibility claim without a matching test entry is only an assertion.
Does it support ETag validators as well as Last-Modified?
The package's documented scope is HTTP Last-Modified and If-Modified-Since handling, not ETag generation. Laravel and Symfony's HttpFoundation already expose setEtag() and isNotModified() if you need content-hash validators. If you combine both, test whether your response's existing ETag is preserved or overwritten.
Can I customize how the last-modified date is calculated?
Yes. The package exposes a configurable date source and configurable caching behavior, so you can control where the timestamp comes from instead of relying on a single hard-coded source. That lets you align the validator with your content model, such as a model's updated_at value. Review the config file after installation and keep the source deterministic across requests.
How does it perform with large, streamed, or binary responses?
The package advertises lightweight middleware, but its behavior with StreamedResponse, BinaryFileResponse, and chunked JSON is not clearly documented. Any validator that derives from response content can add CPU cost or force buffering, so benchmark your heaviest endpoints. If you serve large files or streams, test for memory growth and confirm the Last-Modified value is stable.
Does it work correctly under Laravel Octane and long-lived workers?
The middleware should be stateless, but long-lived workers expose any request-scoped state that leaks between requests. Test the package under Octane with repeated requests and confirm that timestamps and 304 decisions do not carry over from a previous request. Also check that the cached date source is reset or keyed correctly per request.
Is dragon-code/last-modified production-ready and actively maintained?
The project has a single maintainer, very low adoption (8 stars and 0 dependents in the technical evaluation), and recent releases that are mostly compatibility and cosmetic changes. The 4.4.0 release widens Laravel support but includes no functional bug fixes, so open questions about edge cases remain. For critical paths, treat it as a small dependency to fork or replace with a short custom middleware if needed.
How do I test Last-Modified and 304 behavior in a Laravel test?
Use Laravel's HTTP test helpers to send a first request, capture the Last-Modified header, then send a second request with an If-Modified-Since header set to that value and assert a 304 status. Also test a stale If-Modified-Since value to confirm a full 200 response is returned. Add coverage for authenticated routes and any middleware ordering you rely on.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections