{"id":20305068,"url":"https://github.com/8p/eightpointsguzzlebundle","last_synced_at":"2025-05-14T02:06:51.895Z","repository":{"id":11208223,"uuid":"13593847","full_name":"8p/EightPointsGuzzleBundle","owner":"8p","description":"⛽️  Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony","archived":false,"fork":false,"pushed_at":"2025-04-17T08:58:22.000Z","size":1021,"stargazers_count":445,"open_issues_count":13,"forks_count":70,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-10T20:34:18.150Z","etag":null,"topics":["bundle","cache","guzzle","oauth2","php","symfony","wsse"],"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/8p.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"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}},"created_at":"2013-10-15T15:24:34.000Z","updated_at":"2025-04-24T11:24:35.000Z","dependencies_parsed_at":"2025-01-31T05:31:36.382Z","dependency_job_id":"3072fe8d-77cd-43d5-9b9e-56761af43a20","html_url":"https://github.com/8p/EightPointsGuzzleBundle","commit_stats":{"total_commits":314,"total_committers":52,"mean_commits":6.038461538461538,"dds":0.6146496815286624,"last_synced_commit":"71efd775a4c0767ba8bda2af615787520a96aa29"},"previous_names":[],"tags_count":60,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8p%2FEightPointsGuzzleBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8p%2FEightPointsGuzzleBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8p%2FEightPointsGuzzleBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8p%2FEightPointsGuzzleBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/8p","download_url":"https://codeload.github.com/8p/EightPointsGuzzleBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254052726,"owners_count":22006716,"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":["bundle","cache","guzzle","oauth2","php","symfony","wsse"],"created_at":"2024-11-14T17:06:53.967Z","updated_at":"2025-05-14T02:06:46.884Z","avatar_url":"https://github.com/8p.png","language":"PHP","readme":"**[Prerequisites](#prerequisites)** |\n**[Installation](#installation)** |\n**[Configuration](#configuration)** |\n**[Usage](#usage)** |\n**[Plugins](#plugins)** |\n**[Events](#events)** |\n**[Features](#features)** |\n**[Suggestions](#suggestions)** |\n**[Contributing](#contributing)** |\n**[Learn more](#learn-more)** |\n**[License](#license)**\n\n# EightPoints GuzzleBundle for Symfony\n\n[![Total Downloads](https://poser.pugx.org/eightpoints/guzzle-bundle/downloads.png)](https://packagist.org/packages/eightpoints/guzzle-bundle)\n[![Monthly Downloads](https://poser.pugx.org/eightpoints/guzzle-bundle/d/monthly.png)](https://packagist.org/packages/eightpoints/guzzle-bundle)\n[![Latest Stable Version](https://poser.pugx.org/eightpoints/guzzle-bundle/v/stable.png)](https://packagist.org/packages/eightpoints/guzzle-bundle)\n[![Build Status](https://github.com/8p/EightPointsGuzzleBundle/workflows/PHPUnit/badge.svg)](https://github.com/8p/EightPointsGuzzleBundle/actions?query=branch%3Amaster+workflow%3APHPUnit)\n[![Scrutinizer Score](https://scrutinizer-ci.com/g/8p/EightPointsGuzzleBundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/8p/EightPointsGuzzleBundle/)\n[![License](https://poser.pugx.org/eightpoints/guzzle-bundle/license)](https://packagist.org/packages/eightpoints/guzzle-bundle)\n\nThis bundle integrates [Guzzle 6.x|7.x][1] into [Symfony][16]. Guzzle is a PHP library for building RESTful web service clients.\n\nGuzzleBundle follows semantic versioning. Read more on [semver.org][2].\n\n----\n\n## Prerequisites\n - PHP 7.2 or higher\n - Symfony 5.x or 6.x or 7.x\n\n----\n\n## Installation\n\n### Installing the bundle\n\nTo install this bundle, run the command below on the command line and you will get the latest stable version from [Packagist][3].\n\n``` bash\ncomposer require eightpoints/guzzle-bundle\n```\n\n_Note: this bundle has a [Symfony Flex Recipe][14] to automatically register and configure this bundle into your symfony application._\n\nIf your project does *not* use Symfony Flex the following needs to be added to `config/bundles.php` manually:\n\n```php\n\u003c?php\n\nreturn [\n    // other bundles here\n    EightPoints\\Bundle\\GuzzleBundle\\EightPointsGuzzleBundle::class =\u003e ['all' =\u003e true],\n];\n```\n\n----\n\n## Configuration\n\nGuzzle clients can be configured in `config/packages/eight_points_guzzle.yaml`. For projects that use Symfony Flex this file is created\nautomatically upon installation of this bundle. For projects that don't use Symfony Flex this file should be created manually.\n\n```yaml\neight_points_guzzle:\n    # (de)activate logging/profiler; default: %kernel.debug%\n    logging: true\n\n    # configure when a response is considered to be slow (in ms); default 0 (disabled)\n    slow_response_time: 1000\n\n    clients:\n        payment:\n            base_url: 'http://api.payment.example'\n\n            # NOTE: This option marks this Guzzle Client as lazy (https://symfony.com/doc/master/service_container/lazy_services.html)\n            lazy: true # Default `false`\n\n            # guzzle client options (full description here: https://guzzle.readthedocs.org/en/latest/request-options.html)\n            options:\n                auth:\n                    - acme     # login\n                    - pa55w0rd # password\n\n                headers:\n                    Accept: 'application/json'\n\n                # Find proper php const, for example CURLOPT_SSLVERSION, remove CURLOPT_ and transform to lower case.\n                # List of curl options: http://php.net/manual/en/function.curl-setopt.php\n                curl:\n                    sslversion: 1\n\n                timeout: 30\n\n            # plugin settings\n            plugin: ~\n\n        crm:\n            base_url: 'http://api.crm.tld'\n            options:\n                headers:\n                    Accept: 'application/json'\n\n        # More clients here\n```\n\nPlease refer to the [Configuration Reference](src/Resources/doc/configuration-reference.md) for a complete list of all options.\n\n## Usage\n\nGuzzle clients configured through this bundle are available in the Symfony Dependency Injection container under the name\n`eight_points_guzzle.client.\u003cname of client\u003e`. So for example a client configured in the configuration with name `payment` is available\nas `eight_points_guzzle.client.payment`.\n\nSuppose you have the following controller that requires a Guzzle Client:\n\n```php\n\u003c?php\n\nnamespace App\\Controller;\n\nuse Guzzle\\Client;\n\nclass ExampleController\n{\n    public function __construct(Client $client)\n    {\n        $this-\u003eclient = $client;\n    }\n}\n```\n\nUsing manual wiring this controller can be wired as follows:\n\n```yaml\nservices:\n    my.example.controller:\n        class: App\\Controller\\ExampleController\n        arguments: ['@eight_points_guzzle.client.payment']\n```\n\nFor projects that use [autowiring][18], please refer to [our documentation on autowiring](src/Resources/doc/autowiring-clients.md).\n\n----\n\n## Plugins\n\nThis bundle allows to register and integrate plugins to extend functionality of guzzle and this bundle.\n\n### Installation\n\nIn order to install a plugin, find the following lines in `src/Kernel.php`:\n\n```php\nforeach ($contents as $class =\u003e $envs) {\n    if ($envs[$this-\u003eenvironment] ?? $envs['all'] ?? false) {\n        yield new $class();\n    }\n}\n```\n\nand replace them with the following:\n\n```php\nforeach ($contents as $class =\u003e $envs) {\n    if ($envs[$this-\u003eenvironment] ?? $envs['all'] ?? false) {\n        if ($class === \\EightPoints\\Bundle\\GuzzleBundle\\EightPointsGuzzleBundle::class) {\n            yield new $class([\n                new \\Gregurco\\Bundle\\GuzzleBundleOAuth2Plugin\\GuzzleBundleOAuth2Plugin(),\n            ]);\n        } else {\n            yield new $class();\n        }\n    }\n}\n```\n\n### Known and Supported Plugins\n- [gregurco/GuzzleBundleWssePlugin][5]\n- [gregurco/GuzzleBundleCachePlugin][6]\n- [gregurco/GuzzleBundleOAuth2Plugin][7]\n- [neirda24/GuzzleBundleHeaderForwardPlugin][12]\n- [neirda24/GuzzleBundleHeaderDisableCachePlugin][13]\n- [EugenGanshorn/GuzzleBundleRetryPlugin][15]\n\n----\n\n## Events\n\nThis bundle dispatches Symfony events right before a client makes a call and right after a client has made a call.\nThere are two types of events dispatched every time; a _generic_ event, that is dispatched regardless of which client is doing the request,\nand a _client specific_ event, that is dispatched only to listeners specifically subscribed to events from a specific client.\nThese events can be used to intercept requests to a remote system as well as responses from a remote system.\nIn case a generic event listener and a client specific event listener both change a request/response, the changes from the client\nspecific listener override those of the generic listener in case of a collision (both setting the same header for example).\n\n### Listening To Events\n\nIn order to listen to these events you should create a listener and register that listener in the Symfony services configuration as usual:\n\n```yaml\nservices:\n    my_guzzle_listener:\n        class: App\\Service\\MyGuzzleBundleListener\n        tags:\n            # Listen for generic pre transaction event (will receive events for all clients)\n            - { name: 'kernel.event_listener', event: 'eight_points_guzzle.pre_transaction', method: 'onPreTransaction' }\n            # Listen for client specific pre transaction events (will only receive events for the \"payment\" client)\n            - { name: 'kernel.event_listener', event: 'eight_points_guzzle.pre_transaction.payment', method: 'onPrePaymentTransaction' }\n\n            - # Listen for generic post transaction event (will receive events for all clients)\n            - { name: 'kernel.event_listener', event: 'eight_points_guzzle.post_transaction', method: 'onPostTransaction' }\n            # Listen for client specific post transaction events (will only receive events for the \"payment\" client)\n            - { name: 'kernel.event_listener', event: 'eight_points_guzzle.post_transaction.payment', method: 'onPostPaymentTransaction' }\n```\n\nFor more information, read the docs on [intercepting requests and responses](src/Resources/doc/intercept-request-and-response.md).\n\n----\n\n## Features\n\n### Symfony Debug Toolbar / Profiler\n\u003cimg src=\"/src/Resources/doc/img/debug_logs.png\" alt=\"Debug Logs\" title=\"Symfony Debug Toolbar - Guzzle Logs\" style=\"width: 360px\" /\u003e\n\n### Logging\n\nAll requests are logged to Symfony's default logger (`@logger` service) with the following (default) format:\n```\n[{datetime}] eight_points_guzzle.{log_level}: {method} {uri} {code}\n```\n\nExample:\n```\n[2017-12-01 00:00:00] eight_points_guzzle.INFO: GET http://api.domain.tld 200\n```\n\nYou can change the message format by overriding the `eight_points_guzzle.symfony_log_formatter.pattern` parameter.\nFor all options please refer to [Guzzle's MessageFormatter][8].\n\n----\n\n## Suggestions\n\n### Create aliases for clients\n\nIn case your project uses manual wiring it is recommended to create aliases for the clients created with this bundle to\nget easier service names and also to make it easier to switch to other implementations in the future, might the need arise.\n\n``` yaml\nservices:\n   crm.client: '@eight_points_guzzle.client.crm'\n```\n\nIn case your project uses autowiring this suggestion does not apply.\n\n----\n\n## Contributing\n👍 If you would like to contribute to this bundle, please read [CONTRIBUTING.md](CONTRIBUTING.md).\n\n\u003cimg src=\"/src/Resources/doc/img/icon_slack.png\" alt=\"Slack\" title=\"Slack\" style=\"width: 23px; margin-right: -4px;\" /\u003e Join our Slack channel on [Symfony Devs][9] for discussions, questions and more: [#8p-guzzlebundle][10].\n\n🎉 Thanks to all [contributors][11] who participated in this project.\n\n----\n\n## Learn more\n- [Autowiring Clients](src/Resources/doc/autowiring-clients.md)\n- [Configuration Reference](src/Resources/doc/configuration-reference.md)\n- [Disable throwing exceptions on HTTP errors (4xx and 5xx responses)](src/Resources/doc/disable-exception-on-http-error.md)\n- [Environment variables integration](src/Resources/doc/environment-variables-integration.md)\n- [How to create a single-file plugin](src/Resources/doc/how-to-create-a-single-file-plugin.md)\n- [How to redefine class used for clients](src/Resources/doc/redefine-client-class.md)\n- [Intercept request and response](src/Resources/doc/intercept-request-and-response.md)\n\n----\n\n## License\n\nThis bundle is released under the [MIT license](LICENSE).\n\n[1]: http://guzzlephp.org/\n[2]: http://semver.org/\n[3]: https://packagist.org/packages/eightpoints/guzzle-bundle\n[4]: https://github.com/symfony/flex\n[5]: https://github.com/gregurco/GuzzleBundleWssePlugin\n[6]: https://github.com/gregurco/GuzzleBundleCachePlugin\n[7]: https://github.com/gregurco/GuzzleBundleOAuth2Plugin\n[8]: https://github.com/guzzle/guzzle/blob/6.3.0/src/MessageFormatter.php#L14\n[9]: https://symfony.com/slack-invite\n[10]: https://symfony-devs.slack.com/messages/C8LUKU6JD\n[11]: https://github.com/8p/EightPointsGuzzleBundle/graphs/contributors\n[12]: https://github.com/Neirda24/GuzzleBundleHeaderForwardPlugin\n[13]: https://github.com/Neirda24/GuzzleBundleHeaderDisableCachePlugin\n[14]: https://github.com/symfony/recipes-contrib/tree/master/eightpoints/guzzle-bundle\n[15]: https://github.com/EugenGanshorn/GuzzleBundleRetryPlugin\n[16]: https://symfony.com/\n[17]: https://github.com/symfony/skeleton\n[18]: https://symfony.com/doc/current/service_container/autowiring.html\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F8p%2Feightpointsguzzlebundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F8p%2Feightpointsguzzlebundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F8p%2Feightpointsguzzlebundle/lists"}