Skip to content

Commit 3d34fdd

Browse files
committed
[HttpClient][Messenger] add PingWebhook and PingWebhookHandler
1 parent 5e6ea11 commit 3d34fdd

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

src/Symfony/Component/HttpClient/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Add `UriTemplateHttpClient` to use URI templates as specified in the RFC 6570
8+
* Add `PingWehook` and `PingWebhookHandler`
89

910
6.2
1011
---
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\HttpClient\Messenger;
13+
14+
/**
15+
* @author Kevin Bond <kevinbond@gmail.com>
16+
*/
17+
final class PingWebhook
18+
{
19+
public function __construct(
20+
public readonly string $method,
21+
public readonly string $url,
22+
public readonly array $options = [],
23+
) {
24+
}
25+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\HttpClient\Messenger;
13+
14+
use Symfony\Contracts\HttpClient\HttpClientInterface;
15+
use Symfony\Contracts\HttpClient\ResponseInterface;
16+
17+
/**
18+
* @author Kevin Bond <kevinbond@gmail.com>
19+
*/
20+
final class PingWebhookHandler
21+
{
22+
public function __construct(private readonly HttpClientInterface $httpClient)
23+
{
24+
}
25+
26+
public function __invoke(PingWebhook $message): ResponseInterface
27+
{
28+
$response = $this->httpClient->request($message->method, $message->url, $message->options);
29+
$response->getStatusCode();
30+
31+
return $response;
32+
}
33+
}

src/Symfony/Component/HttpClient/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"psr/http-client": "^1.0",
4040
"symfony/dependency-injection": "^5.4|^6.0",
4141
"symfony/http-kernel": "^5.4|^6.0",
42+
"symfony/messenger": "^6.3",
4243
"symfony/process": "^5.4|^6.0",
4344
"symfony/stopwatch": "^5.4|^6.0"
4445
},

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy