Skip to content

Refine PSR-18 HTTP client recipe#433

Open
samdark wants to merge 2 commits intomasterfrom
57-http-client
Open

Refine PSR-18 HTTP client recipe#433
samdark wants to merge 2 commits intomasterfrom
57-http-client

Conversation

@samdark
Copy link
Copy Markdown
Member

@samdark samdark commented May 5, 2026

Closes #57

Copilot AI review requested due to automatic review settings May 5, 2026 17:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the “Making HTTP requests” cookbook recipe to focus on using PSR-18/PSR-17 abstractions in Yii apps, with Guzzle as an example implementation (per #57).

Changes:

  • Rewrites the recipe to emphasize “depend on PSR interfaces” and removes the longer, multi-section Guzzle walkthrough.
  • Adds container configuration and two focused examples (GET + JSON POST) using PSR-18 + PSR-17.
  • Adds a short unit-testing example using Guzzle’s MockHandler.

Comment thread src/cookbook/making-http-requests.md
Comment on lines +47 to +51
HttpFactory::class => HttpFactory::class,
RequestFactoryInterface::class => HttpFactory::class,
ResponseFactoryInterface::class => HttpFactory::class,
StreamFactoryInterface::class => HttpFactory::class,
UriFactoryInterface::class => HttpFactory::class,
Comment on lines 123 to 133
```php
<?php

declare(strict_types=1);

use GuzzleHttp\Client;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\StreamFactoryInterface;

class BatchApiService
final readonly class WebhookClient
{
Comment thread src/cookbook/making-http-requests.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Demo usage of PSR-18 HTTP clients

2 participants