Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0b44a27

Browse files
committed
feature#51100 [PsrHttpMessageBridge] Import the bridge into the monorepo (fabpot, dunglas, KorvinSzanto, xabbuh, aimeos, ahundiak, Danielss89, rougin, csunolgomez, Jérôme Parmentier, mtibben, Nyholm, ajgarlag, uphlewis, samnela, grachevko, nicolas-grekas, tinyroy, danizord, Daniel Degasperi, rbaarsma, Ekman, 4rthem, derrabus, mleczakm, iluuu1994, Tobion, chalasr, lemon-juice, franmomu, cidosx, erikn69, AurelienPillevesse)
This PR was merged into the 6.4 branch.Discussion----------[PsrHttpMessageBridge] Import the bridge into the monorepo| Q | A| ------------- | ---| Branch? | 6.4| Bug fix? | no| New feature? | yes| Deprecations? | no| Tickets | N/A| License | MIT| Doc PR | TODO⚠️ Don't squash!I propose to import the `symfony/psr-http-message-bridge` package into the Symfony monorepo for further maintenance.Commits-------e40dd66 [PsrHttpMessageBridge] Patch return types and fix CS266c09f [PsrHttpMessageBridge] Import the bridge into the monorepo0c0323a Add 'src/Symfony/Bridge/PsrHttpMessage/' from commit '581ca6067eb62640de5ff08ee1ba6850a0ee472e'581ca60 Prepare release 2.3.145d0349 Fix CS6410dda bug#122 Don't rely on Request::getPayload() to populate the parsed body (nicolas-grekas)ef03b6d Don't rely on Request::getPayload() to populate the parsed body3c62b81 minor#120 Prepare release 2.3.0 (derrabus)96acbfd Prepare release 2.3.07eedd34 feature#119 Implement ValueResolverInterface (derrabus)0b54b85 Implement ValueResolverInterface6b2f5df feature#117 Leverage `Request::getPayload()` to populate the parsed body of PSR-7 requests (AurelienPillevesse)3a8caad Leverage `Request::getPayload()` to populate the parsed body of PSR-7 requests18c9e82 minor#118 Add native types where possible (derrabus)4fd4323 Add native types where possible28a732c minor#115 Prepare the 2.2.0 release (derrabus)7944831 cs fix99ddcaa Prepare the 2.2.0 release8a5748d feature#113 Bump psr/http-message version (erikn69)ec83c1c Bump psr/http-message version694016e feature#114 Drop support for Symfony 4 (derrabus)b360b35 Drop support for Symfony 4998d8d2 minor#111 Adjustments for PHP CS Fixer 3 (derrabus)5fa5f62 Adjustments for PHP CS Fixer 3a125b93 minor#110 Add PHP 8.2 to CI (derrabus)4592df2 Add PHP 8.2 to CI4617ac3 bug#109 perf: ensure timely flush stream buffers (cidosx)8c8a75b perf: ensure timely flush stream buffersd444f85 Update changelog155a7ae bug#107 Ignore invalid HTTP headers when creating PSR7 objects (nicolas-grekas)9a78a16 Ignore invalid HTTP headers when creating PSR7 objectsbdb2871 minor#104 Add missing .gitattributes (franmomu)808561a Add missing .gitattributes316f5cb bug#103 Fix for wrong type passed to moveTo() (lemon-juice)7f3b5c1 Fix for wrong type passed to moveTo()22b37c8 minor#101 Release v2.1.2 (chalasr)c382d76 Release v2.1.2c81476c feature#100 Allow Symfony 6 (chalasr)c7a0be3 Allow Symfony 6df83a38 minor#98 Add PHP 8.1 to CI (derrabus)b2bd334 Add PHP 8.1 to CI824711c minor#99 Add return types to fixtures (derrabus)f8f70fa Add return types to fixturesd558dcd minor#97 Inline $tmpDir (derrabus)d152649 Inline $tmpDirf12a9e6 minor#96 Run PHPUnit on GitHub Actions (derrabus)ab64c69 Run PHPUnit on GitHub Actionsc901299 bug#95 Allow `psr/log` 2 and 3 (derrabus)8e13ae4 Allow psr/log 2 and 326068fa Minor cleanups87fabb9 Fix copyright year3d9241f minor#92 remove link to sensio extra bundle which removed psr7 support (Tobion)7078739 remove link to sensio extra bundle which removed psr7 support81db2d4 feature#89 PSR HTTP message converters for controllers (derrabus)aa26e61 PSR HTTP message converters for controllerse62b239 minor#91 Fix CS (derrabus)2bead22 Fix CS488df9b minor#90 Fix CI failures with Xdebug 3 and test on PHP 7.4/8.0 as well (derrabus)a6697fd Fix CI failures with Xdebug 3 and test on PHP 7.4/8.0 as wellc62f7d0 Update branch-alias51a21cb Update changeloga20fff9 bug#87 Fix populating server params from URI in HttpFoundationFactory (nicolas-grekas)4933e04 bug#86 Create cookies as raw in HttpFoundationFactory (nicolas-grekas)66095a5 Fix populating server params from URI in HttpFoundationFactory42cca49 Create cookies as raw in HttpFoundationFactorycffb3a8 bug#85 Fix BinaryFileResponse with range to psr response conversion (iluuu1994)5d5932d Fix BinaryFileResponse with range to psr response conversione44f249 bug#81 Don't normalize query string in PsrHttpFactory (nicolas-grekas)bc25829 Don't normalize query string in PsrHttpFactorydf735ec bug#78 Fix populating default port and headers in HttpFoundationFactory (mleczakm)4f30401 Fix populating default port and headers in HttpFoundationFactory1309b64 bug#77 fix conversion for https requests (4rthem)e86de3f minor#79 Allow installation on php 8 (derrabus)9243f93 Allow installation on php 8.d336c73 fix conversion for https requests126903c Fix format of CHANGELOG.mdce709cd feature#75 Remove deprecated code (fabpot)dfc5238 Remove deprecated code9d3e80d bug#72 Use adapter for UploadedFile objects (nicolas-grekas)a4f9f6d Use adapter for UploadedFile objectsec7892b Fix CHANGELOG, bump branch-alias7ab4fe4 minor#70 Updated CHANGELOG (rbaarsma)9ad4bcc Updated CHANGELOGc4c904a minor#71 Cleanup after bump to Symfony v4.4 (nicolas-grekas)e9a9557 Cleanup after bump to Symfony v4.43d10a6c feature#66 Add support for streamed Symfony request (Ekman)df26630 Add support for streamed Symfony request5aa8ca9 bug#69 Allow Symfony 5.0 (rbaarsma)1158149 Allow Symfony 5.081ae86d Merge branch '1.1'a33352a bug#64 Fixed createResponse (ddegasperi)7a4b449 minor#65 Fix tests (ajgarlag)19905b0 Fix tests580de38 Fixed createResponse9ab9d71 minor#63 Added links to documentation (Nyholm)59b9406 Added links to documentationc1cb51c feature#50 Add support for streamed response (danizord)4133c7a bug#48 Convert Request/Response multiple times (Nyholm)8564bf7 Convert Request/Response multiple times7cc1605 Add support for streamed responseaebc14b feature#62 bump to PHP 7.1 (nicolas-grekas)8e10923 bump to PHP 7.15e5e0c3 Revert "Undeprecate DiactorosFactory for 1.1"921f866 Undeprecate DiactorosFactory for 1.18592ca3 bug#61 removed 'Set-Cookie' from header when it is already converted to a Symfony header cookie (tinyroy)dd1111e removed 'Set-Cookie' from header when it is already converted to a Symfony header cookieba672d8 bump branch-alias5f9a032 typof2c48c5 fix tests3a52e44 bug#59 Fix SameSite attribute conversion from PSR7 to HttpFoundation (ajgarlag)5ee1f8f Fix SameSite attribute conversion from PSR7 to HttpFoundationf6d7d3a bug#58 [Bugfix] Typo header set-sookie (grachevko)16eb6e1 minor#57 Excluded tests from classmap (samnela)36a8065 Deprecate DiactorosFactory, use nyholm/psr7 for tests5076934 bug#54Fix#51 (compatability issue with zendframework/zend-diactoros ^2.0) (uphlewis)757ea81 [Bugfix] Typo header set-sookie25f9c3a Excluded tests from classmap8ff61e5 Fix compatability issue with "zendframework/zend-diactoros": "^2.0." (#51)53c15a6 updated CHANGELOGc821241 bumped version to 1.1f26d01f minor#47 Updated changelog (Nyholm)c2282e3 Updated changelogeddd6c8 feature#43 Create PSR-7 messages using PSR-17 factories (ajgarlag)dd81b4b Create PSR-7 messages using PSR-17 factoriesf11f173 feature#45 Fixed broken build (Nyholm)8780dd3 Fixed broken buildc2b7579 bug#30 Fix the request target in PSR7 Request (mtibben)94fcfa5 Fix the request target in PSR7 Request64640ee minor#38 Run PHP 5.3 tests on Precise (Lctrs)64c0cb0 Run PHP 5.3 tests on Preciseb209840 minor#32 Allow Symfony 4 (dunglas)97635f1 Allow Symfony 4147a238 minor#31 test suite compatibility with PHPUnit 6 (xabbuh)f5c46f0 test suite compatibility with PHPUnit 666085f2 preparing 1.0 release533d3e4 added a CHANGELOG for 1.014269f9 bug#28 Fix REQUEST_METHOD on symfony request (csunol)98ab85a Fix REQUEST_METHOD on symfony request29be4f8 updated LICENCE yeard2db47c removed obsolete CHANGELOG file1c30b17 bug#22Fixes#16 Symfony Request created without any URI (rougin)a59c572Fixes#16 Symfony Request created without any URI7a5aa92 bug#23Fixes#9 Bridge error when no file is selected (ahundiak, Danielss89)a1a631a Update assert error messagee5d62e6 Fixes based on code-review101b608 Handles null file in createrequest bridge.d16c63c bug#18 Allow multiple calls to Request::getContent() (aimeos)9624b8b Allow multiple calls to Request::getContent()9c747c4 Merge pull request#19 from xabbuh/travis-configa388c43 update Travis CI configurationac5cd86 minor#14 Remove use of deprecated 'deep' parameter in tests (KorvinSzanto)305c0fe Remove use of deprecated 'deep' parameter3664dc0 minor#7 Test Diactoros Factory with PHP 5.4 (dunglas)bab1530 Test Diactoros Factory with PHP 5.4d7660b8 Suggest psr/http-message-implementationdc7e308 removed the branch alias for now as we are pre 1.03f8977e feature#1 Initial support (dunglas)ca41146 Initial support01b110b added the initial set of files
2 parentsbfb5963 +e40dd66 commit0b44a27

File tree

30 files changed

+2778
-0
lines changed

30 files changed

+2778
-0
lines changed

‎composer.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"psr/clock":"^1.0",
4545
"psr/container":"^1.1|^2.0",
4646
"psr/event-dispatcher":"^1.0",
47+
"psr/http-message":"^1.0|^2.0",
4748
"psr/link":"^1.1|^2.0",
4849
"psr/log":"^1|^2|^3",
4950
"symfony/contracts":"^2.5|^3.0",
@@ -94,6 +95,7 @@
9495
"symfony/property-access":"self.version",
9596
"symfony/property-info":"self.version",
9697
"symfony/proxy-manager-bridge":"self.version",
98+
"symfony/psr-http-message-bridge":"self.version",
9799
"symfony/rate-limiter":"self.version",
98100
"symfony/remote-event":"self.version",
99101
"symfony/routing":"self.version",
@@ -182,6 +184,7 @@
182184
"Symfony\\Bridge\\Doctrine\\":"src/Symfony/Bridge/Doctrine/",
183185
"Symfony\\Bridge\\Monolog\\":"src/Symfony/Bridge/Monolog/",
184186
"Symfony\\Bridge\\ProxyManager\\":"src/Symfony/Bridge/ProxyManager/",
187+
"Symfony\\Bridge\\PsrHttpMessage\\":"src/Symfony/Bridge/PsrHttpMessage/",
185188
"Symfony\\Bridge\\Twig\\":"src/Symfony/Bridge/Twig/",
186189
"Symfony\\Bundle\\":"src/Symfony/Bundle/",
187190
"Symfony\\Component\\":"src/Symfony/Component/"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/Testsexport-ignore
2+
/phpunit.xml.distexport-ignore
3+
/.gitattributesexport-ignore
4+
/.gitignoreexport-ignore
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
vendor/
2+
composer.lock
3+
phpunit.xml
4+
/Tests/Fixtures/App/var
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
namespaceSymfony\Bridge\PsrHttpMessage\ArgumentValueResolver;
13+
14+
usePsr\Http\Message\MessageInterface;
15+
usePsr\Http\Message\RequestInterface;
16+
usePsr\Http\Message\ServerRequestInterface;
17+
useSymfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
18+
useSymfony\Component\HttpFoundation\Request;
19+
useSymfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
20+
useSymfony\Component\HttpKernel\Controller\ValueResolverInterfaceasBaseValueResolverInterface;
21+
useSymfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
22+
23+
/**
24+
* Injects the RequestInterface, MessageInterface or ServerRequestInterface when requested.
25+
*
26+
* @author Iltar van der Berg <kjarli@gmail.com>
27+
* @author Alexander M. Turek <me@derrabus.de>
28+
*/
29+
finalclass PsrServerRequestResolverimplements ArgumentValueResolverInterface, ValueResolverInterface
30+
{
31+
privateconstSUPPORTED_TYPES = [
32+
ServerRequestInterface::class =>true,
33+
RequestInterface::class =>true,
34+
MessageInterface::class =>true,
35+
];
36+
37+
private$httpMessageFactory;
38+
39+
publicfunction__construct(HttpMessageFactoryInterface$httpMessageFactory)
40+
{
41+
$this->httpMessageFactory =$httpMessageFactory;
42+
}
43+
44+
publicfunctionsupports(Request$request,ArgumentMetadata$argument):bool
45+
{
46+
if ($thisinstanceof BaseValueResolverInterface) {
47+
trigger_deprecation('symfony/psr-http-message-bridge','2.3','Method "%s" is deprecated, call "resolve()" without calling "supports()" first.',__METHOD__);
48+
}
49+
50+
returnself::SUPPORTED_TYPES[$argument->getType()] ??false;
51+
}
52+
53+
publicfunctionresolve(Request$request,ArgumentMetadata$argument):\Traversable
54+
{
55+
if (!isset(self::SUPPORTED_TYPES[$argument->getType()])) {
56+
return;
57+
}
58+
59+
yield$this->httpMessageFactory->createRequest($request);
60+
}
61+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
namespaceSymfony\Bridge\PsrHttpMessage\ArgumentValueResolver;
13+
14+
useSymfony\Component\HttpKernel\Controller\ValueResolverInterfaceasBaseValueResolverInterface;
15+
16+
if (interface_exists(BaseValueResolverInterface::class)) {
17+
/** @internal */
18+
interface ValueResolverInterfaceextends BaseValueResolverInterface
19+
{
20+
}
21+
}else {
22+
/** @internal */
23+
interface ValueResolverInterface
24+
{
25+
}
26+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
CHANGELOG
2+
=========
3+
4+
6.4
5+
---
6+
7+
* Import the bridge into the Symfony monorepo and synchronize releases
8+
9+
2.3.1
10+
-----
11+
12+
* Don't rely on`Request::getPayload()` to populate the parsed body
13+
14+
2.3.0
15+
-----
16+
17+
* Leverage`Request::getPayload()` to populate the parsed body of PSR-7 requests
18+
* Implement`ValueResolverInterface` introduced with Symfony 6.2
19+
20+
2.2.0
21+
-----
22+
23+
* Drop support for Symfony 4
24+
* Bump minimum version of PHP to 7.2
25+
* Support version 2 of the psr/http-message contracts
26+
27+
2.1.3
28+
-----
29+
30+
* Ignore invalid HTTP headers when creating PSR7 objects
31+
* Fix for wrong type passed to`moveTo()`
32+
33+
2.1.2
34+
-----
35+
36+
* Allow Symfony 6
37+
38+
2.1.0
39+
-----
40+
41+
* Added a`PsrResponseListener` to automatically convert PSR-7 responses returned by controllers
42+
* Added a`PsrServerRequestResolver` that allows injecting PSR-7 request objects into controllers
43+
44+
2.0.2
45+
-----
46+
47+
* Fix populating server params from URI in HttpFoundationFactory
48+
* Create cookies as raw in HttpFoundationFactory
49+
* Fix BinaryFileResponse with Content-Range PsrHttpFactory
50+
51+
2.0.1
52+
-----
53+
54+
* Don't normalize query string in PsrHttpFactory
55+
* Fix conversion for HTTPS requests
56+
* Fix populating default port and headers in HttpFoundationFactory
57+
58+
2.0.0
59+
-----
60+
61+
* Remove DiactorosFactory
62+
63+
1.3.0
64+
-----
65+
66+
* Added support for streamed requests
67+
* Added support for Symfony 5.0+
68+
* Fixed bridging UploadedFile objects
69+
* Bumped minimum version of Symfony to 4.4
70+
71+
1.2.0
72+
-----
73+
74+
* Added new documentation links
75+
* Bumped minimum version of PHP to 7.1
76+
* Added support for streamed responses
77+
78+
1.1.2
79+
-----
80+
81+
* Fixed createResponse
82+
83+
1.1.1
84+
-----
85+
86+
* Deprecated DiactorosFactory, use PsrHttpFactory instead
87+
* Removed triggering of deprecation
88+
89+
1.1.0
90+
-----
91+
92+
* Added support for creating PSR-7 messages using PSR-17 factories
93+
94+
1.0.2
95+
-----
96+
97+
* Fixed request target in PSR7 Request (mtibben)
98+
99+
1.0.1
100+
-----
101+
102+
* Added support for Symfony 4 (dunglas)
103+
104+
1.0.0
105+
-----
106+
107+
* Initial release
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
namespaceSymfony\Bridge\PsrHttpMessage\EventListener;
13+
14+
usePsr\Http\Message\ResponseInterface;
15+
useSymfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory;
16+
useSymfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface;
17+
useSymfony\Component\EventDispatcher\EventSubscriberInterface;
18+
useSymfony\Component\HttpKernel\Event\ViewEvent;
19+
useSymfony\Component\HttpKernel\KernelEvents;
20+
21+
/**
22+
* Converts PSR-7 Response to HttpFoundation Response using the bridge.
23+
*
24+
* @author Kévin Dunglas <dunglas@gmail.com>
25+
* @author Alexander M. Turek <me@derrabus.de>
26+
*/
27+
finalclass PsrResponseListenerimplements EventSubscriberInterface
28+
{
29+
private$httpFoundationFactory;
30+
31+
publicfunction__construct(HttpFoundationFactoryInterface$httpFoundationFactory =null)
32+
{
33+
$this->httpFoundationFactory =$httpFoundationFactory ??newHttpFoundationFactory();
34+
}
35+
36+
/**
37+
* Do the conversion if applicable and update the response of the event.
38+
*/
39+
publicfunctiononKernelView(ViewEvent$event):void
40+
{
41+
$controllerResult =$event->getControllerResult();
42+
43+
if (!$controllerResultinstanceof ResponseInterface) {
44+
return;
45+
}
46+
47+
$event->setResponse($this->httpFoundationFactory->createResponse($controllerResult));
48+
}
49+
50+
publicstaticfunctiongetSubscribedEvents():array
51+
{
52+
return [
53+
KernelEvents::VIEW =>'onKernelView',
54+
];
55+
}
56+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp