Registry / http-client / guzzlehttp-guzzle-services

guzzlehttp-guzzle-services

JSON →
library1.7.0phppackagistunverified

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.

composer require guzzlehttp/guzzle-services
INSTALL
IMPORT
SIG · GUZZLEHTTP-GUZZLE-
G
guzzlehttp-guzzle-services
http-clientphpv1.7.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GuzzleClient
use GuzzleHttp\Command\Guzzle\GuzzleClient;

Create a service client from a Guzzle service description and call an operation.

use GuzzleHttp\Command\Guzzle\GuzzleClient; use GuzzleHttp\Client as HttpClient; $client = new GuzzleClient(new HttpClient(), [ 'baseUrl' => 'https://api.example.com', 'operations' => [ 'getUser' => [ 'httpMethod' => 'GET', 'uri' => '/users/{id}', 'responseModel' => 'getUserResponse', 'parameters' => [ 'id' => ['required' => true, 'type' => 'string', 'location' => 'uri'] ] ] ], 'models' => [ 'getUserResponse' => [ 'type' => 'object', 'properties' => [ 'name' => ['location' => 'json', 'type' => 'string'] ] ] ] ]); $result = $client->getUser(['id' => '123']); echo $result['name'];
Debug
Known issues
gotchaService descriptions must be defined manually or loaded from a JSON file; no automatic generation.
fix
Define operations and models in an array or load from a JSON file using GuzzleHttp\Command\Guzzle\Description.
affects: >=1.0.0
Upgrade
Version history
1.7.0latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
27 hits · last 30 days
node
26
Resources
guzzlehttp-guzzle-services — pip install guzzlehttp-guzzle-services · libregistry