guzzlehttp / guzzle-services
Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.
Requires
- php: ^7.4 || ^8.0
- guzzlehttp/command: ^2.0
- guzzlehttp/guzzle: ^8.0
- guzzlehttp/promises: ^3.0
- guzzlehttp/psr7: ^3.0
- guzzlehttp/uri-template: ^2.0
- symfony/polyfill-php80: ^1.25
- symfony/polyfill-php82: ^1.27
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.8.2
- guzzlehttp/test-server: ^1.0
- phpunit/phpunit: ^9.6.34
Suggests
- gimler/guzzle-description-loader: ^0.0.4
This package is auto-updated.
Last update: 2026-07-20 14:12:58 UTC
README
guzzlehttp/guzzle-services builds service-description-driven clients on top of
guzzlehttp/command. A
service description maps named operations and parameters to HTTP requests, then
maps responses into result data.
Use this package when you are building an SDK-style client for an API and want
operations described in arrays instead of hand-writing every request serializer.
If you only need to send HTTP requests directly, install
guzzlehttp/guzzle
instead.
Installation
composer require guzzlehttp/guzzle-services
Version Guidance
| Version | Status | PHP Version |
|---|---|---|
| 2.0 | Latest | >=7.4,<8.6 |
| 1.7 | Maintenance | >=7.2.5,<8.6 |
Quick Start
use GuzzleHttp\Client; use GuzzleHttp\Command\Guzzle\Description; use GuzzleHttp\Command\Guzzle\GuzzleClient; $description = new Description([ 'baseUri' => 'https://api.example.com', 'operations' => [ 'getUser' => [ 'httpMethod' => 'GET', 'uri' => '/users/{id}', 'responseModel' => 'user', 'parameters' => [ 'id' => ['type' => 'string', 'location' => 'uri'], ], ], ], 'models' => [ 'user' => [ 'type' => 'object', 'additionalProperties' => ['location' => 'json'], ], ], ]); $client = new GuzzleClient(new Client(), $description); $result = $client->getUser(['id' => '123']);
Documentation
Security
If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see Security Policy for more information.
License
Guzzle is made available under the MIT License (MIT). Please see License File for more information.
For Enterprise
Available as part of the Tidelift Subscription
The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.