Add a new PSR-17 factory to Psr17FactoryProvider #3120
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is curious performance benchmark of the PSR-7 and PSR-17 implementations (Guzzle, HttpSoft, Laminas, Nyholm, Slim) - https://github.com/devanych/psr-http-benchmark.
The fastest is HttpSoft, the slowest - Slim.
So I've added
HttpSoftPsr17Factory
to the Slim's factory set to give users the possibility to use theHttpSoft
implementation of the PSR-7.What was generally done:
1) Adding
HttpSoftPsr17Factory::class
to the$factories
property of theSlim\Factory\Psr17\Psr17FactoryProvider
classI placed the class for the second position because it's the fastest implementation of the PSR-7 according to the benchmark. But the Slim's implementation remains in first place because I think it's normal to give priority to packages from the Slim's ecosystem.
2) Adding the new
HttpSoftPsr17Factory
class to the Slim/Factory/Psr17 folder3) Adding the httpsoft/http-message and httpsoft/http-server-request packages to the
composer.json
file (--dev section)4) Adding
[HttpSoftPsr17Factory::class, HttpSoftServerRequest::class]
to theprovideImplementations()
method in theServerRequestCreatorFactoryTest
class5) Adding
[HttpSoftPsr17Factory::class, HttpSoftResponseFactory::class]
to theprovideImplementations()
method in theAppFactoryTest
class6) Editing
README.md
(added a mention of the HttpSoft PSR-7 implementation along with other implementations)About tests