From 295c82867d07261f2fa4b3a26677519fc6f7f5f6 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 3 Aug 2021 13:52:11 +0200 Subject: [PATCH] GuzzleStreamFactory: support guzzle/psr7 version 2 (#141) --- CHANGELOG.md | 4 ++++ src/StreamFactory/GuzzleStreamFactory.php | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c580bd..0ab29dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.11.2] - 2021-08-03 + +- Support GuzzleHttp/Psr7 version 2.0 in the (deprecated) GuzzleStreamFactory. + ## [1.11.1] - 2021-05-24 - Support GuzzleHttp/Psr7 version 2.0 in the (deprecated) GuzzleUriFactory. diff --git a/src/StreamFactory/GuzzleStreamFactory.php b/src/StreamFactory/GuzzleStreamFactory.php index 9adeeb5..14d83e9 100644 --- a/src/StreamFactory/GuzzleStreamFactory.php +++ b/src/StreamFactory/GuzzleStreamFactory.php @@ -2,6 +2,7 @@ namespace Http\Message\StreamFactory; +use GuzzleHttp\Psr7\Utils; use Http\Message\StreamFactory; /** @@ -18,6 +19,10 @@ final class GuzzleStreamFactory implements StreamFactory */ public function createStream($body = null) { + if (class_exists(Utils::class)) { + return Utils::streamFor($body); + } + return \GuzzleHttp\Psr7\stream_for($body); } }