{"id":13396081,"url":"https://github.com/spatie/laravel-responsecache","last_synced_at":"2026-02-21T17:13:29.426Z","repository":{"id":35060829,"uuid":"39198480","full_name":"spatie/laravel-responsecache","owner":"spatie","description":"Speed up a Laravel app by caching the entire response","archived":false,"fork":false,"pushed_at":"2025-05-12T21:56:47.000Z","size":838,"stargazers_count":2586,"open_issues_count":1,"forks_count":230,"subscribers_count":39,"default_branch":"main","last_synced_at":"2025-05-14T22:02:52.730Z","etag":null,"topics":["cache","laravel","performance","php","varnish"],"latest_commit_sha":null,"homepage":"https://freek.dev/1351-caching-the-entire-response-of-a-laravel-app","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mattn/go-mastodon","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spatie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"spatie","custom":"https://spatie.be/open-source/support-us"}},"created_at":"2015-07-16T13:31:04.000Z","updated_at":"2025-05-13T05:48:47.000Z","dependencies_parsed_at":"2024-03-12T00:35:23.784Z","dependency_job_id":"662fc63a-2af7-4326-9b5e-cb0a238ac13a","html_url":"https://github.com/spatie/laravel-responsecache","commit_stats":{"total_commits":350,"total_committers":78,"mean_commits":4.487179487179487,"dds":0.3828571428571429,"last_synced_commit":"12bf51679f551fcfc3d40fdc32bc9a03f8853f6d"},"previous_names":[],"tags_count":77,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-responsecache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-responsecache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-responsecache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-responsecache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatie","download_url":"https://codeload.github.com/spatie/laravel-responsecache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254235686,"owners_count":22036962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","laravel","performance","php","varnish"],"created_at":"2024-07-30T18:00:39.290Z","updated_at":"2026-02-21T17:13:29.419Z","avatar_url":"https://github.com/spatie.png","language":"PHP","funding_links":["https://github.com/sponsors/spatie","https://spatie.be/open-source/support-us"],"categories":["Popular Packages","Uncategorized","PHP","Paquetes utiles"],"sub_categories":["Uncategorized"],"readme":"\u003cdiv align=\"left\"\u003e\n    \u003ca href=\"https://spatie.be/open-source?utm_source=github\u0026utm_medium=banner\u0026utm_campaign=laravel-responsecache\"\u003e\n      \u003cpicture\u003e\n        \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://spatie.be/packages/header/laravel-responsecache/html/dark.webp\"\u003e\n        \u003cimg alt=\"Logo for laravel-responsecache\" src=\"https://spatie.be/packages/header/laravel-responsecache/html/light.webp\"\u003e\n      \u003c/picture\u003e\n    \u003c/a\u003e\n\n\u003ch1\u003eSpeed up an app by caching the entire response\u003c/h1\u003e\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/laravel-responsecache.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-responsecache)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/spatie/laravel-responsecache/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/spatie/laravel-responsecache/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/spatie/laravel-responsecache/fix-php-code-style-issues.yml?branch=main\u0026label=code%20style\u0026style=flat-square)](https://github.com/spatie/laravel-responsecache/actions?query=workflow%3A\"Fix+PHP+code+style+issues\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-responsecache.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-responsecache)\n\n\u003c/div\u003e\n\nThis Laravel package can cache an entire response. By default it will cache all successful GET requests that return text based content (such as HTML and JSON) for a week. This could potentially speed up the response quite considerably.\n\nThe first time a request comes in, the package will save the response before sending it to the user. When the same request comes in again, the cached response is returned without going through the entire application.\n\nHere's a quick example:\n\n```php\nuse Spatie\\ResponseCache\\Middlewares\\CacheResponse;\n\nRoute::middleware(CacheResponse::for(minutes(10)))-\u003egroup(function () {\n    Route::get('/posts', [PostController::class, 'index']);\n    Route::get('/posts/{post}', [PostController::class, 'show']);\n});\n```\n\nFor pages where brief staleness is acceptable, you can use flexible caching. After the lifetime expires, the stale response is still served instantly while the cache refreshes in the background. Once the grace period is over, the cache is considered expired and the next request will be fully recalculated:\n\n```php\nuse Spatie\\ResponseCache\\Middlewares\\FlexibleCacheResponse;\n\nRoute::get('/dashboard', [DashboardController::class, 'index'])\n    -\u003emiddleware(FlexibleCacheResponse::for(lifetime: hours(1), grace: minutes(5)));\n```\n\n## Support us\n\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/laravel-responsecache.jpg?t=1\" width=\"419px\" /\u003e](https://spatie.be/github-ad-click/laravel-responsecache)\n\nWe invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).\n\nWe highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).\n\n## Documentation\n\nAll documentation is available [on our documentation site](https://spatie.be/docs/laravel-responsecache).\n\n## Testing\n\nYou can run the tests with:\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Freek Van der Herten](https://github.com/freekmurze)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flaravel-responsecache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatie%2Flaravel-responsecache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flaravel-responsecache/lists"}