{"id":41479793,"url":"https://github.com/hasnat/guzzle-mirror-middleware","last_synced_at":"2026-01-23T17:16:12.113Z","repository":{"id":62514954,"uuid":"210052052","full_name":"hasnat/guzzle-mirror-middleware","owner":"hasnat","description":"Middleware to mirror requests to multiple clients.","archived":false,"fork":false,"pushed_at":"2019-09-29T11:15:19.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-23T07:46:38.842Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hasnat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-21T20:52:49.000Z","updated_at":"2024-12-30T09:19:05.000Z","dependencies_parsed_at":"2022-11-02T13:03:18.531Z","dependency_job_id":null,"html_url":"https://github.com/hasnat/guzzle-mirror-middleware","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/hasnat/guzzle-mirror-middleware","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasnat%2Fguzzle-mirror-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasnat%2Fguzzle-mirror-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasnat%2Fguzzle-mirror-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasnat%2Fguzzle-mirror-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hasnat","download_url":"https://codeload.github.com/hasnat/guzzle-mirror-middleware/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasnat%2Fguzzle-mirror-middleware/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28696523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T15:57:05.722Z","status":"ssl_error","status_checked_at":"2026-01-23T15:56:27.656Z","response_time":59,"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":[],"created_at":"2026-01-23T17:16:11.503Z","updated_at":"2026-01-23T17:16:12.100Z","avatar_url":"https://github.com/hasnat.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Guzzle Mirror Middleware\n=====\n\n[![Latest Version](https://img.shields.io/github/release/hasnat/guzzle-mirror-middleware.svg?style=flat-square)](https://github.com/hasnat/guzzle-mirror-middleware/releases)\n[![Build Status](https://img.shields.io/travis/hasnat/guzzle-mirror-middleware/master.svg?style=flat-square)](https://travis-ci.org/hasnat/guzzle-mirror-middleware)\n[![Total Downloads](https://img.shields.io/packagist/dt/hasnat/guzzle-mirror-middleware.svg?style=flat-square)](https://packagist.org/packages/hasnat/guzzle-mirror-middleware)\n\nThis package provides middleware for [guzzle](https://github.com/guzzle/guzzle/) for mirroring request to multiple clients:\n\nInstallation\n-------\n\nTo install, use composer:\n\n```\ncomposer require hasnat/guzzle-mirror-middleware\n```\n\nUsage\n-------\n\nTo use this middleware, you need to initialize it like:\n\nSetup Mirror Clients:\n```php\n$mirrorsMiddleware = new \\GuzzleMirror\\GuzzleMirrorMiddleware([\n    'mirrors' =\u003e [\n        [\n            'client' =\u003e new \\GuzzleHttp\\Client(['base_uri' =\u003e 'http://mirror1.com/']),\n            'ignore_mirror_failures'    =\u003e false, // default=false -- failures will be sent on ignored_failures_callback, on true MirrorFailedException is thrown\n            'ignore_mirror_methods'     =\u003e ['GET'] // default=[] -- all the methods you'd like to ignore for this mirror\n        ],\n        [\n            'client' =\u003e new \\GuzzleHttp\\Client(['base_uri' =\u003e 'http://mirror2.com/'])\n        ],\n        [\n            'client' =\u003e new \\GuzzleHttp\\Client(['base_uri' =\u003e 'http://mirror3.com/'])\n        ]\n    ],\n    'mirrors_concurrency'       =\u003e 4,  // default=4 -- send to 4 mirrors at a time\n    'no_mirror_on_failure'      =\u003e true, // default=true -- if there's a failure in main request don't send to mirrors\n    'mirror_responses'          =\u003e function(array $responses) {}, // default=null -- all mirror responses\n    'ignored_failures_callback' =\u003e function(array $failures) {}, // default=null -- when ignoring failures no MirrorFailedException is thrown but you can get failures here\n])\n```\n\nAnd inject it to Guzzle with something like:\n```php\n$handlerStack = HandlerStack::create();\n$handlerStack-\u003epush(new \\GuzzleMirror\\GuzzleMirrorMiddleware([\n    'mirrors' =\u003e [\n        ['client' =\u003e new \\GuzzleHttp\\Client(['base_uri' =\u003e 'http://mirror1.com/'])],\n        ['client' =\u003e new \\GuzzleHttp\\Client(['base_uri' =\u003e 'http://mirror2.com/'])],\n        ['client' =\u003e new \\GuzzleHttp\\Client(['base_uri' =\u003e 'http://mirror3.com/'])]\n    ]\n]));\n$this-\u003eclient = new GuzzleHttp\\Client([\n    'base_uri' =\u003e 'base_uri' =\u003e 'http://example.com/',\n    'handler' =\u003e $handlerStack\n]);\n```\n\nFrom now on every request sent with `$guzzleClient` will be replicated on mirrors.\n\n\nTesting\n-------\n\n`hasnat/guzzle-mirror-middleware` has a [PHPUnit](https://phpunit.de) test suite and a coding style compliance test suite using [PHP CS Fixer](http://cs.sensiolabs.org/).\n\nTo run the tests, run the following command from the project folder.\n\n``` bash\n$ docker-compose run test\n```\n\n\nLicense\n-------\n\nMIT\n\n[PSR-2]: http://www.php-fig.org/psr/psr-2/\n[PSR-4]: http://www.php-fig.org/psr/psr-4/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasnat%2Fguzzle-mirror-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhasnat%2Fguzzle-mirror-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasnat%2Fguzzle-mirror-middleware/lists"}