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

Rob Allen:
OuputBuffer Middleware for Expressive
Oct 25, 2017 @ 14:56:14

In a quick post to his site Rob Allen shares code for an OutputBuffer middleware for use with the Zend Expressive framework. Zend Expressive is a middleware-driven framework that makes use of several Zend Framework components to get the job done.

When developing an Expressive application, if you use var_dump(), echo, print_r(), etc when you get [an] error.

This occurs after your data has been displayed and makes perfect sense as Expressive is unable to send headers as you've already started sending the body. To solve this, you need some middleware.

He includes the code for the middleware that grabs the current output being pushed to the user and, using PHP's own output buffering, takes all output and pushes it into the body, preventing any messages about output before the rendering takes place.

tagged: zendexpressive outputbuffer output middleware example

Link: https://akrabat.com/ouputbuffer-middleware-for-expressive/

Dylan Bridgman:
Improving perceived load time
Aug 06, 2015 @ 14:43:34

On Medium.com Dylan Bridgman has posted a tutorial with a few tips helping you improve the perceived load time of your application, the time between when the page starts loading and the user can first do something with its contents.

In this article I will concentrate on perceived load time. That is the time from when a page starts loading until the user is able to proceed. There have been other articles on this topic, some of which go into far more detail in some areas. My intention is to give a summary on the latest information and what you should be doing in PHP. I will link to additional information where applicable.

He breaks the advice up into three main categories: output buffering, multiple connections and using correctly structured pages. Under each section there's a few sub-points with more information, details on implementation and links to other additional information. He also includes an example that combines all of the advice into one PHP/HTML script outputting some basic content.

tagged: perceived load time tutorial outputbuffer thread structure

Link: https://medium.com/@dylanbr/improving-perceived-load-time-a83aa32851b0


Trending Topics: