From 0c0aa897c2224f19619ec374f80be0898602c911 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 29 May 2018 13:39:36 -0500 Subject: [PATCH 1/2] Deprecate emitters and the Server class Per #295, these classes have equivalents or 1:1 mappings via the package zendframework/zend-httphandlerrunner. As such, they are deprecated for the 1.8.0 release, to be removed in version 2.0. --- doc/book/api.md | 7 +++++++ doc/book/emitting-responses.md | 7 +++++++ doc/book/overview.md | 5 ++--- doc/book/usage.md | 7 +++++++ src/Response/EmitterInterface.php | 10 ++++++---- src/Response/SapiEmitter.php | 6 +++++- src/Response/SapiEmitterTrait.php | 6 +++++- src/Response/SapiStreamEmitter.php | 6 +++++- src/Server.php | 5 ++++- 9 files changed, 48 insertions(+), 11 deletions(-) diff --git a/doc/book/api.md b/doc/book/api.md index b2f78f1a..6ae3a150 100644 --- a/doc/book/api.md +++ b/doc/book/api.md @@ -177,6 +177,13 @@ In most cases, you will only use the methods defined in the `UploadedFileInterfa ## Server +> ### Deprecated +> +> The class `Zend\Diactoros\Server` is deprecated as of the 1.8.0 release. We +> recommend using the class `Zend\HttpHandlerRunner\RequestHandlerRunner` via +> the package [zendframework/zend-httphandlerrunner](https://docs.zendframework.com/zend-httphandlerrunner) +> instead. + `Zend\Diactoros\Server` represents a server capable of executing a callback. It has four methods: ```php diff --git a/doc/book/emitting-responses.md b/doc/book/emitting-responses.md index 897b64ae..b682fa4e 100644 --- a/doc/book/emitting-responses.md +++ b/doc/book/emitting-responses.md @@ -1,5 +1,12 @@ # Emitting responses +> ## Deprecated +> +> Emitters are deprecated from Diactoros starting with version 1.8.0. The +> functionality is now available for any PSR-7 implementation via the package +> [zendframework/zend-httphandlerrunner](https://docs.zendframework.com/zend-httphandlerrunner). +> We suggest using that functionality instead. + If you are using a non-SAPI PHP implementation and wish to use the `Server` class, or if you do not want to use the `Server` implementation but want to emit a response, this package provides an interface, `Zend\Diactoros\Response\EmitterInterface`, defining a method `emit()` for emitting the diff --git a/doc/book/overview.md b/doc/book/overview.md index ff7462d1..16dbf99b 100644 --- a/doc/book/overview.md +++ b/doc/book/overview.md @@ -6,7 +6,6 @@ well as a "server" implementation similar to [node's http.Server](http://nodejs. This package exists: -- to provide a proof-of-concept of the accepted PSR HTTP message interfaces with relation to - server-side applications. -- to provide a node-like paradigm for PHP front controllers. +- to provide an implementation of [PSR-7 HTTP message interfaces](https://www.php-fig.org/psr/psr-7) +- with relation to server-side applications. - to provide a common methodology for marshaling a request from the server environment. diff --git a/doc/book/usage.md b/doc/book/usage.md index c4ab74d2..80406c2d 100644 --- a/doc/book/usage.md +++ b/doc/book/usage.md @@ -118,6 +118,13 @@ $response = $response ### "Serving" an application +> ### Deprecated +> +> The class `Zend\Diactoros\Server` is deprecated as of the 1.8.0 release. We +> recommend using the class `Zend\HttpHandlerRunner\RequestHandlerRunner` via +> the package [zendframework/zend-httphandlerrunner](https://docs.zendframework.com/zend-httphandlerrunner) +> instead. + `Zend\Diactoros\Server` mimics a portion of the API of node's `http.Server` class. It invokes a callback, passing it an `ServerRequest`, an `Response`, and optionally a callback to use for incomplete/unhandled requests. diff --git a/src/Response/EmitterInterface.php b/src/Response/EmitterInterface.php index f27b4a9c..04414864 100644 --- a/src/Response/EmitterInterface.php +++ b/src/Response/EmitterInterface.php @@ -1,9 +1,7 @@ Date: Tue, 29 May 2018 13:42:17 -0500 Subject: [PATCH 2/2] Adds CHANGELOG entry for #303 --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3b4af86..b2baf158 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,11 @@ All notable changes to this project will be documented in this file, in reverse ### Deprecated -- Nothing. +- [#303](https://github.com/zendframework/zend-diactoros/pull/303) deprecates `Zend\Diactoros\Response\EmitterInterface` and its various implementations. These are now provided via the + [zendframework/zend-httphandlerrunner](https://docs.zendframework.com/zend-httphandlerrunner) package as 1:1 substitutions. + +- [#303](https://github.com/zendframework/zend-diactoros/pull/303) deprecates the `Zend\Diactoros\Server` class. Users are directed to the `RequestHandlerRunner` class from the + [zendframework/zend-httphandlerrunner](https://docs.zendframework.com/zend-httphandlerrunner) package as an alternative. ### Removed