{"id":15755185,"url":"https://github.com/wyrihaximus/reactphp-http-middleware-response-cache","last_synced_at":"2025-05-13T01:24:45.372Z","repository":{"id":52421205,"uuid":"106047116","full_name":"WyriHaximus/reactphp-http-middleware-response-cache","owner":"WyriHaximus","description":"Response caching middleware for @reactphp's HTTP server","archived":false,"fork":false,"pushed_at":"2023-12-05T08:54:08.000Z","size":220,"stargazers_count":4,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T05:34:41.929Z","etag":null,"topics":["cache","hacktoberfest","http","middleware","middleware-caches","php","php7","reactphp"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WyriHaximus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":"WyriHaximus"}},"created_at":"2017-10-06T20:23:49.000Z","updated_at":"2023-03-03T08:38:26.000Z","dependencies_parsed_at":"2024-10-25T10:31:18.900Z","dependency_job_id":null,"html_url":"https://github.com/WyriHaximus/reactphp-http-middleware-response-cache","commit_stats":{"total_commits":57,"total_committers":4,"mean_commits":14.25,"dds":0.3157894736842105,"last_synced_commit":"85cfcf63f551bae31cd8a85b6a29030549c2e760"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Freactphp-http-middleware-response-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Freactphp-http-middleware-response-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Freactphp-http-middleware-response-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Freactphp-http-middleware-response-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WyriHaximus","download_url":"https://codeload.github.com/WyriHaximus/reactphp-http-middleware-response-cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253852146,"owners_count":21973866,"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","hacktoberfest","http","middleware","middleware-caches","php","php7","reactphp"],"created_at":"2024-10-04T08:20:26.600Z","updated_at":"2025-05-13T01:24:45.355Z","avatar_url":"https://github.com/WyriHaximus.png","language":"PHP","funding_links":["https://github.com/sponsors/WyriHaximus"],"categories":[],"sub_categories":[],"readme":"# Middleware that caches the response code and body of an URL list\n\n[![Build Status](https://travis-ci.org/WyriHaximus/reactphp-http-middleware-response-cache.svg?branch=master)](https://travis-ci.org/WyriHaximus/reactphp-http-middleware-response-cache)\n[![Latest Stable Version](https://poser.pugx.org/WyriHaximus/react-http-middleware-response-cache/v/stable.png)](https://packagist.org/packages/WyriHaximus/react-http-middleware-response-cache)\n[![Total Downloads](https://poser.pugx.org/WyriHaximus/react-http-middleware-response-cache/downloads.png)](https://packagist.org/packages/WyriHaximus/react-http-middleware-response-cache)\n[![Code Coverage](https://scrutinizer-ci.com/g/WyriHaximus/reactphp-http-middleware-response-cache/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/WyriHaximus/reactphp-http-middleware-response-cache/?branch=master)\n[![License](https://poser.pugx.org/WyriHaximus/react-http-middleware-response-cache/license.png)](https://packagist.org/packages/WyriHaximus/react-http-middleware-response-cache)\n[![PHP 7 ready](http://php7ready.timesplinter.ch/WyriHaximus/reactphp-http-middleware-response-cache/badge.svg)](https://travis-ci.org/WyriHaximus/reactphp-http-middleware-response-cache)\n\n# Install\n\nTo install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect \nthe latest version and bind it with `^`.\n\n```\ncomposer require wyrihaximus/react-http-middleware-response-cache\n```\n\nThis middleware caches the response code and body from a list of given URL's. Note that not headers will be \ncached at this point. The middleware accepts a cache configuration implementing `CacheConfigurationInterface` \nas first argument which will decide when to store something in the cache and what. As second argument it \naccepts a cache implementing [`CacheInterface`](https://reactphp.org/cache/#cacheinterface) so either \n[`ArrayCache`](https://reactphp.org/cache/#arraycache) shipping with [`react/cache`](https://reactphp.org/cache/) \nor any cache implementing [`CacheInterface`](https://reactphp.org/cache/#cacheinterface) from the \n[cache implementations](https://github.com/reactphp/react/wiki/Users#cache-implementations) listed at \nthe [ReactPHP users wiki](https://github.com/reactphp/react/wiki/Users).\n\n# Usage\n\n```php\n$server = new Server([\n    /** Other middleware */\n    new ResponseCacheMiddleware(\n        new CacheConfiguration(\n            [\n                '/',\n                '/robots.txt',\n                '/favicon.ico',\n                '/cache/***', // Anything that starts with /cache/ in the path will be cached\n                '/api/???', // Anything that starts with /cache/ in the path will be cached (query is included in the cache key)\n            ],\n            [ // Optional, array with headers to include in the cache\n                'Content-Type',\n            ]\n        ),\n        new ArrayCache() // Optional, will default to ArrayCache but any CacheInterface cache will work. \n    ),\n    /** Other middleware */\n]);\n```\n\n# Sessions\n\nUsing this middleware together with [`wyrihaximus/react-http-middleware-session`](https://github.com/WyriHaximus/reactphp-http-middleware-session) then \nplease take a look at [`wyrihaximus/react-http-middleware-response-cache-session-cache-configuration`](https://github.com/WyriHaximus/reactphp-http-middleware-response-cache-session-cache-configuration) to \nensure you don't serve cached responses to users with active sessions.\n\n# License\n\nThe MIT License (MIT)\n\nCopyright (c) 2018 Cees-Jan Kiewiet\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyrihaximus%2Freactphp-http-middleware-response-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwyrihaximus%2Freactphp-http-middleware-response-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyrihaximus%2Freactphp-http-middleware-response-cache/lists"}