Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Deprecate emitters and the Server class #303

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions doc/book/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions doc/book/emitting-responses.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 2 additions & 3 deletions doc/book/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
7 changes: 7 additions & 0 deletions doc/book/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 6 additions & 4 deletions src/Response/EmitterInterface.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @see http://github.com/zendframework/zend-diactoros for the canonical source repository
* @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com)
* @see https://github.com/zendframework/zend-diactoros for the canonical source repository
* @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
*/

namespace Zend\Diactoros\Response;

use Psr\Http\Message\ResponseInterface;

/**
* @deprecated since 1.8.0. The package zendframework/zend-httphandlerrunner
* now provides this functionality.
*/
interface EmitterInterface
{
/**
Expand Down
6 changes: 5 additions & 1 deletion src/Response/SapiEmitter.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<?php
/**
* @see https://github.com/zendframework/zend-diactoros for the canonical source repository
* @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
*/

namespace Zend\Diactoros\Response;

use Psr\Http\Message\ResponseInterface;

/**
* @deprecated since 1.8.0. The package zendframework/zend-httphandlerrunner
* now provides this functionality.
*/
class SapiEmitter implements EmitterInterface
{
use SapiEmitterTrait;
Expand Down
6 changes: 5 additions & 1 deletion src/Response/SapiEmitterTrait.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @see https://github.com/zendframework/zend-diactoros for the canonical source repository
* @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
*/

Expand All @@ -16,6 +16,10 @@
use function str_replace;
use function ucwords;

/**
* @deprecated since 1.8.0. The package zendframework/zend-httphandlerrunner
* now provides this functionality.
*/
trait SapiEmitterTrait
{
/**
Expand Down
6 changes: 5 additions & 1 deletion src/Response/SapiStreamEmitter.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @see https://github.com/zendframework/zend-diactoros for the canonical source repository
* @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
*/

Expand All @@ -14,6 +14,10 @@
use function strlen;
use function substr;

/**
* @deprecated since 1.8.0. The package zendframework/zend-httphandlerrunner
* now provides this functionality.
*/
class SapiStreamEmitter implements EmitterInterface
{
use SapiEmitterTrait;
Expand Down
5 changes: 4 additions & 1 deletion src/Server.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @see https://github.com/zendframework/zend-diactoros for the canonical source repository
* @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
*/

Expand All @@ -18,6 +18,9 @@
*
* Given a callback, takes an incoming request, dispatches it to the
* callback, and then sends a response.
*
* @deprecated since 1.8.0. We recommend using the `RequestHandlerRunner` class
* from the zendframework/zend-httphandlerrunner package instead.
*/
class Server
{
Expand Down