{"id":20701437,"url":"https://github.com/lukewaite/ringphp-guzzle-handler","last_synced_at":"2025-07-11T09:40:31.491Z","repository":{"id":48708954,"uuid":"96588410","full_name":"lukewaite/ringphp-guzzle-handler","owner":"lukewaite","description":null,"archived":false,"fork":false,"pushed_at":"2021-07-13T14:39:25.000Z","size":42,"stargazers_count":15,"open_issues_count":3,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T20:24:44.724Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukewaite.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-08T01:32:12.000Z","updated_at":"2023-03-08T08:29:30.000Z","dependencies_parsed_at":"2022-07-26T10:48:34.748Z","dependency_job_id":null,"html_url":"https://github.com/lukewaite/ringphp-guzzle-handler","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewaite%2Fringphp-guzzle-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewaite%2Fringphp-guzzle-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewaite%2Fringphp-guzzle-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewaite%2Fringphp-guzzle-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukewaite","download_url":"https://codeload.github.com/lukewaite/ringphp-guzzle-handler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249640665,"owners_count":21304824,"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":[],"created_at":"2024-11-17T00:41:47.370Z","updated_at":"2025-04-22T23:13:53.105Z","avatar_url":"https://github.com/lukewaite.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RingPHP Guzzle Handler\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/lukewaite/ringphp-guzzle-handler.svg?style=flat-square)](https://packagist.org/packages/lukewaite/ringphp-guzzle-handler)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/lukewaite/ringphp-guzzle-handler/master.svg?style=flat-square)](https://travis-ci.org/lukewaite/ringphp-guzzle-handler)\n[![Coveralls](https://img.shields.io/coveralls/github/lukewaite/ringphp-guzzle-handler/master.svg?style=flat-square)](https://coveralls.io/github/lukewaite/ringphp-guzzle-handler)\n[![Total Downloads](https://img.shields.io/packagist/dt/lukewaite/ringphp-guzzle-handler.svg?style=flat-square)](https://packagist.org/packages/lukewaite/ringphp-guzzle-handler)\n\n## Usage\n\n### Installing\n\nThis package can be installed with composer.\n\n    $ composer require lukewaite/ringphp-guzzle-handler\n\n### Elasticsearch\n\n```php\n$guzzleHandler  = new LukeWaite\\RingPhpGuzzleHandler\\GuzzleHandler();\n\n$client = Elasticsearch\\ClientBuilder::create()\n            -\u003esetHandler($guzzleHandler)\n            -\u003ebuild();\n```\n\nOptionally, you may create a Guzzle client manually, and pass it through to the constructor:\n```php\n$guzzle = new GuzzleHttp\\Client();\n$guzzleHandler  = new LukeWaite\\RingPhpGuzzleHandler\\GuzzleHandler($guzzle);\n\n$client = Elasticsearch\\ClientBuilder::create()\n            -\u003esetHandler($guzzleHandler)\n            -\u003ebuild();\n```\n\n## What have you done?\nI've built a [RingPHP][ringphp] Handler that uses Guzzle as the transport.\n\n### You've done wot mate?\nYes - I built a handler for RingPHP (an older GuzzleHttp project) that\nuses Guzzle 6 as the transport.\n\n### Reasoning\nThe ElasticSearch PHP SDK uses the RingPHP client library under the\ncovers. You can provide a `Handler` when creating the client, but it has\nto be a RingPHP handler.\n\nNewRelic supports tracking external requests for Guzzle, but not for\nRingPHP. Using this handler means we can get more accurate instrumentation\non our transactions.\n\n#### Example NewRelic APM Chart, Before and After Deployment\n![newrelic before and after](https://lukewaite.ca/images/2017-07-15-newrelic-elasticsearch/newrelic-instrumentation.png)\n\n## How true to RingPHP is this?\nThe spec for [implementing handlers][implementing-handlers] has been\nfollowed, but in some cases I've had to go out of my way to tune this\nfor the ElasticSearch PHP SDK.\n\n#### $response `body`\nYou're supposed to be able to return a [lot of different types][response]\nhere, but ElasticSearch expects it to be only a stream, so that's what we\nreturn.\n\n#### $response `transfer_stats`\nTransfer stats is supposed to be an arbitrary array of stats provided by\nthe handler, but it turns out ElasticSearch expects some pretty specific\nstuff from the default CURL handler to be in there.\n\n[implementing-handlers]: http://ringphp.readthedocs.io/en/latest/client_handlers.html#implementing-handlers\n[response]: http://ringphp.readthedocs.io/en/latest/spec.html#responses\n[ringphp]: https://github.com/guzzle/RingPHP\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukewaite%2Fringphp-guzzle-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukewaite%2Fringphp-guzzle-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukewaite%2Fringphp-guzzle-handler/lists"}