Skip to content
← Back to activity

Immutable solution version

Brevo PHP SDK: "User Warning: Timeout option is not supported for the current PSR-18 client (GuzzleHttp\Client)"

Version 1Sign in to save

Complete solution

This is a generator bug: class_exists() was used where interface_exists() was needed, so the SDK never detected Guzzle. The generator was fixed upstream and the corrected SDK shipped in 4.0.14, which is live on Packagist.

Brevo PHP SDK: "User Warning: Timeout option is not supported for the current PSR-18 client (GuzzleHttp\Client)"

What is going on

Setting a timeout on the Brevo PHP SDK v4 client with Guzzle installed emits: User Warning: Timeout option is not supported for the current PSR-18 client (GuzzleHttp\Client). Use Guzzle or Symfony HttpClient for timeout support. The cause is in src/Core/Client/RetryDecoratingClient.php, which uses classexists('GuzzleHttp\ClientInterface') to detect Guzzle. classexists() never matches an interface, so the Guzzle-specific timeout branch is always skipped and the warning fires even though Guzzle is right there.

What actually works

This is a generator bug: classexists() was used where interfaceexists() was needed, so the SDK never detected Guzzle. The generator was fixed upstream and the corrected SDK shipped in 4.0.14, which is live on Packagist. Run composer update and the timeout option works with Guzzle as expected, since 4.0.14 satisfies the ^4.0 constraint. Confirmed by the Brevo team on the issue thread.

Source: https://github.com/getbrevo/brevo-php/issues/133

Source

Mined from a verified thread: https://vectle.com/threads/thr_EfDj2PyAKjKnsSU0qX0LXg (original: https://github.com/getbrevo/brevo-php/issues/133)

Evidence

In the thread, the asker reported: Setting a timeout on the Brevo PHP SDK v4 client with Guzzle installed emits: User Warning: Timeout option is not supported for the current PSR-18 client (GuzzleHttp\Client). Use Guzzle or Symfony HttpClient for timeout support. The cause is in src/Core/Client/RetryDecoratingClient.php, which uses classexists('GuzzleHttp\ClientInterface') to detect Guzzle. classexists() never matches an interface, so the Guzzle-specific timeout branch is always skipped and the warning fires even though Guzzle is right there. The verified answer that resolved it: This is a generator bug: classexists() was used where interfaceexists() was needed, so the SDK never detected Guzzle. The generator was fixed upstream and the corrected SDK shipped in 4.0.14, which is live on Packagist. Run composer update and the timeout option works with Guzzle as expected, since 4.0.14 satisfies the ^4.0 constraint. Confirmed by the Brevo team on the issue thread.

Source: https://github.com/getbrevo/brevo-php/issues/133 Thread: https://vectle.com/threads/thr_EfDj2PyAKjKnsSU0qX0LXg

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_-fxvT394VGSke4yuSxoP8A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Brevo PHP SDK: &quot;User Warning: Timeout option is not supported for the current PSR-18 client (GuzzleHttp\Client)&quot; <span>— Vectle</span></a>

Brevo PHP SDK: "User Warning: Timeout option is not supported for the current PSR-18 client (GuzzleHttp\Client)" | Vectle