Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Zend Framework Blog:
Emitting Responses with Diactoros
Sep 15, 2017 @ 09:14:05

On the Zend Framework blog they've posted a tutorial from project lead Matthew Weier O'Phinney showing how to use the Diactoros package to create response emitters. These emitters are just methods of output related to HTTP handling (like headers, response codes and normal text output).

When writing middleware-based applications, at some point you will need to emit your response.

PSR-7 defines the various interfaces related to HTTP messages, but does not define how they will be used. Diactoros defines several utility classes for these purposes, including a ServerRequestFactory for generating a ServerRequest instance from the PHP SAPI in use, and a set of emitters, for emitting responses back to the client. In this post, we'll detail the purpose of emitters, the emitters shipped with Diactoros, and some strategies for emitting content to your users.

He starts by describing what "emitters" are in the context of PSR-7 applications and shows the code definition of the EmitterInterface, the base of all emitter classes. After covering some of the emitters that Diactoros includes he shows how to create one to emit file information and how you can mix and match them in a emitter "stack" to perform more that one operation on the output.

tagged: diactoros tutorial emitter response output example interface

Link: https://framework.zend.com/blog/2017-09-14-diactoros-emitters.html

Alexey Zakhlestin's Blog:
YAML: Syck for PHP is not read-only anymore
Jul 06, 2007 @ 07:51:07

Alexey Zakhlestin mentions some new YAML functionality he's worked up - emitter functionality:

One more good news for you, YAML-users. I've implemented emitter functionality in php-binding of syck library. It is quite straight-forward, no fancy stuff for now, but it should work.

Supported datatypes include associative arrays, strings, integers, floats, booleans and nulls. He includes an example of the code in action (dumping out the information for an associative array). You can get this latest update from the subversion source on his site.

tagged: yaml syck emitter functionality datatypes example subversion yaml syck emitter functionality datatypes example subversion

Link:

Alexey Zakhlestin's Blog:
YAML: Syck for PHP is not read-only anymore
Jul 06, 2007 @ 07:51:07

Alexey Zakhlestin mentions some new YAML functionality he's worked up - emitter functionality:

One more good news for you, YAML-users. I've implemented emitter functionality in php-binding of syck library. It is quite straight-forward, no fancy stuff for now, but it should work.

Supported datatypes include associative arrays, strings, integers, floats, booleans and nulls. He includes an example of the code in action (dumping out the information for an associative array). You can get this latest update from the subversion source on his site.

tagged: yaml syck emitter functionality datatypes example subversion yaml syck emitter functionality datatypes example subversion

Link: