oten

Guzzle requests default values

Posted 1 year ago by oten

Is it possible to include default options in multiple Guzzle requests? Basically what I'm looking for is to inject the following config in every Client instance instead of writing it down for every API call.

$client = new Client([
    'base_uri' => 'https://api.example.com/',
    'query' => [
        'api_key' => 'myApiKey'
    ]
]);

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.