{"id":36971834,"url":"https://github.com/coolblue/php-http-client-middleware","last_synced_at":"2026-01-13T21:54:45.672Z","repository":{"id":39634249,"uuid":"239501142","full_name":"coolblue/php-http-client-middleware","owner":"coolblue","description":"HTTP Client middleware is a middleware solution for PSR-18 (HTTP Client).","archived":false,"fork":false,"pushed_at":"2024-11-22T10:53:08.000Z","size":29,"stargazers_count":10,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-27T20:29:39.175Z","etag":null,"topics":["http","http-client","middleware","mit","php","psr","psr-18"],"latest_commit_sha":null,"homepage":"","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/coolblue.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2020-02-10T11:59:00.000Z","updated_at":"2024-11-22T10:53:12.000Z","dependencies_parsed_at":"2023-01-25T21:30:33.082Z","dependency_job_id":null,"html_url":"https://github.com/coolblue/php-http-client-middleware","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/coolblue/php-http-client-middleware","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolblue%2Fphp-http-client-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolblue%2Fphp-http-client-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolblue%2Fphp-http-client-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolblue%2Fphp-http-client-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coolblue","download_url":"https://codeload.github.com/coolblue/php-http-client-middleware/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolblue%2Fphp-http-client-middleware/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28401701,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["http","http-client","middleware","mit","php","psr","psr-18"],"created_at":"2026-01-13T21:54:45.525Z","updated_at":"2026-01-13T21:54:45.660Z","avatar_url":"https://github.com/coolblue.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTTP Client middleware\n\nHTTP Client middleware is a middleware solution for [PSR-18 (HTTP Client)](http://www.php-fig.org/psr/psr-18). \n\nThis package contains both a middleware interface as well as a ready to use HTTP Client that is capable of handling middleware.\n\n**NB** This package does not contain any middleware implementations.\n\n## Rationale\nThe interface offered by PSR-18 (HTTP Client) does not offer any (configuration) options offered by known HTTP abstractions - for example Guzzle and Symfony HttpClient. This makes implementations of this interface exchangeable, but does require you to write these configurations yourself. This can mean additional code that is repeated in multiple locations. Something that might be undesirable. \n\nThis might be solved by using a solution similar to the middleware defined in [PSR-15 (HTTP Server Request Handlers)](https://www.php-fig.org/psr/psr-15). Using middleware will allow centralization of functionality without the necessity of extending or wrapping a client. It also enables you to perform actions both _before_ performing the actual request and _after_ the actual request. \n\n## Installation\n\n```bash\ncomposer require coolblue/http-client-middleware \n```\n\n## Usage \nMiddleware needs to comply to the interface `\\Coolblue\\Http\\Client\\MiddlewareInterface`:\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nnamespace Coolblue\\Http\\Client;\n\nuse Psr\\Http\\Client\\ClientInterface;\nuse Psr\\Http\\Message\\RequestInterface;\nuse Psr\\Http\\Message\\ResponseInterface;\n\ninterface MiddlewareInterface\n{    \n    public function process(RequestInterface $request, ClientInterface $client): ResponseInterface;\n}\n\n```\n\nTo create a middleware enabled client:\n\n```php\n\n$client = new Client(); // an instance of \\Psr\\Http\\Client\\ClientInterface\n$middlewareOne = new Middleware(); // an instance of \\Coolblue\\Client\\Http\\MiddlewareInterface\n$middlewareTwo = new Middleware(); // an instance of \\Coolblue\\Client\\Http\\MiddlewareInterface\n\n$middlewareClient = new \\Coolblue\\Http\\Client\\MiddlewareClient(\n    $client, \n    $middlewareOne, \n    $middlewareTwo\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoolblue%2Fphp-http-client-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoolblue%2Fphp-http-client-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoolblue%2Fphp-http-client-middleware/lists"}