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

Cees-Jan Kiewiet:
ReactPHP with RecoilPHP: Creating for/http-middleware-psr15-adapter
Feb 09, 2018 @ 17:21:13

Cees-Jan Kiewiet is back with the latest tutorial in his series covering ReactPHP and RecoilPHP. In the previous parts he introduced some of the basic concepts and set up the first bits of code combining ReactPHP and RecoilPHP. In this latest tutorial (part three) he shows how to integrate this with a PSR-15 compliant middleware to evaluate response time.

There are more uses for coroutines than just making working with promises easier. In this post we're diving into the details on how they are used by the Friends of ReactPHP in the PSR-15 Middleware adapter for react/http.

When we started discussing how middleware for react/http should work we also look at the state of PSR-15 at the time. We decided against implementing it directly because of the fully blocking nature of PSR-15, in favour of callable. Which turned into an even better decision when return type hints where added to it to PSR-15. Now I love PSR-15, and middleware in general, which is why I created for/http-middleware-psr15-adapter to bridge the gap.

He starts with the code required to create a normal PSR-15 middleware and recreating the same functionality in a ReactPHP middleware. The article then shows how to use the package he developed to transform the middleware "on the fly" to enable it to be used both as a normal PSR-15 middleware and as a ReactPHP middleware. He ends the post with a word of caution and a bit of advice about using this method of rewriting - basically that just because you can doesn't mean you should.

tagged: reactphp recoil psr15 middleware translate onthefly package tutorial part3 series

Link: https://blog.wyrihaximus.net/2018/02/reactphp-with-recoilphp-party-three-http-middleware-psr-15-adapter/

That Podcast:
Episode 45: The One Where We Talk about PSR-15 Again
Feb 06, 2018 @ 17:18:10

That Podcast, hosted by PHP community members Beau Simensen and Dave Marshall, has posted their latest episode - Episode #45: The One Where We Talk about PSR-15 Again .

Beau and Dave discuss the current state of PHP FIG's HTTP Handler PSR.

Other topics mentioned in the episode include:

You can listen to this latest episode either using the in-page audio player or by downloading the mp3 directly. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter for the latest updates when new shows are released.

tagged: thatpodcast ep54 podcast beausimensen davemarshall psr15

Link: https://thatpodcast.io/episodes/episode-45-the-one-where-we-talk-about-psr-15-again

Matthew Weier O'Phinney:
PSR-15
Jan 24, 2018 @ 16:43:53

In a new post to his site Matthew Weier O'Phinney, lead developer on Zend Framework and representative in the PHP-FIG, covers the acceptance of PSR-15 by the group. PSR-15 relates to the creation of server request handlers and middleware that can use PSR-7 formatted messages.

Yesterday, following a unanimous vote from its Core Committee, PHP-FIG formally accepted the proposed PSR-15, HTTP Server Handlers standard.

This new standard defines interfaces for request handlers and middleware. These have enormous potential impact on the PHP ecosystem, as they provide standard mechanisms for writing HTTP-facing, server-side applications. Essentially, they pave the way for developers to create re-usable web components that will work in any application that works with PSR-15 middleware or request handlers!

He starts with a bit of background around the initial idea of the standard and some of the discussions that came up around it. The initial draft of the standard was modified to more correctly handle issues around response modification and the use of "handlers" for request/response manipulation. He then covers the final version of the standard, defined in the standard's documentation and enforceable via the psr/server-handler interface. Finally he covers how to use this to create re-usable middleware and an example using Expressive.

tagged: phpfig psr15 standard request response middleware handler

Link: https://mwop.net/blog/2018-01-23-psr-15.html

Zend Framework Blog:
Expressive 3 Preview
Dec 18, 2017 @ 17:14:27

The Zend Framework blog has posted a preview of Expressive v3, the next major release of their lightweight framework based on its larger sibling, Zend Framework.

Last week, the PSR-15 working group voted to start its review phase. PSR-15 seeks to standardize server-side request handlers and middleware, and both Stratigility and Expressive have been implementing draft specifications since their version 2 releases. Entering the review phase is an important moment: it means that the working group feels the specification is stable and ready for adoption. If, after the review period is over, no major changes are required, the specification can be presented to the PHP-FIG core committed for a final acceptance vote, at which point it will be frozen and ready for mass adoption.

Our plan is to have Stratigility and Expressive follow the new specification in its final form. To that end, we have been executing on a plan to prepare all our projects that work with PSR-15 to adopt the latest round of changes.

That work is ready today!

The post starts by talking about what changes come along with the PSR-15 specification including changes in namespacing, interfaces being renamed and a package split. It then talks about what changes they've made based on the PSR-15 updates and how you can test your own project to ensure it will be compatible with the updates. This includes changes that will be required to upgrade as the PSR-15 changes are not backwards compatible.

tagged: zendframework zendexpressive version preview update psr15

Link: https://framework.zend.com/blog/2017-12-14-expressive-3-dev.html

Matthew Weier O'Phinney:
Using Anonymous Classes to Write Middleware
Apr 03, 2017 @ 16:22:48

Matthew Weier O'Phinney, lead developer on the Zend Framework project, has written up a new post for his site showing how to use anonymous classes to write middleware for your applications (several frameworks support the concept of middleware these days).

I faced an interesting question recently with regards to middleware: What happens when we go from a convention-based to a contract-based approach when programming?

Convention-based approaches usually allow for duck-typing; with middleware, it means you can write PHP callables - usually closures - and just expect them to work.

Contract-based approaches use interfaces. I think you can see where this is going.

He starts off looking at some of the currently popular methods for creating middleware basic them off of either the PSR-7 standard or the proposed PSR-15 HTTP middleware, each with code examples to illustrate. The post then gets to the point with a look at anonymous class-based middleware and some of the advantages they provide. He refactors both a PSR-7 middleware and a closure-based middleware over to PSR-15 using this method.

tagged: middleware anonymous class psr7 psr15 closure tutorial

Link: https://mwop.net/blog/2017-03-30-anonymous-class-middleware.html

PHP Town Hall Podcast:
Episode 50: Low down on PSR-15
Jan 11, 2017 @ 19:14:07

The PHP Town Hall podcast has returned with a new episode that gives you the low down on PSR-15, a proposal being discussed by the PHP-FIG group to provide structure around middleware implementation.

An all star cast this episode, as Ben and Phil are joined by regular guest Anthony Ferrara - thinker of good ideas and long-time part-time side-line contributor to the PHP-FIG, Woody Gilk - one-speed rider & BDFL of Kohana, and Beau Simensen - author of a bunch of stuff including StackPHP.

Here we’re talking about some awesome stuff the PHP-FIG is working on: PSR-15 (HTTP Middleware). [...] We discuss all this, and the reason PSR-7 (HTTP Message) is not enough for the ecosystem to benefit from shareable middleware.

You can catch this latest episode in a few different ways including the use of the in-page audio or video player, by downloading the mp3 directly or you can view the recording of the live Google Hangout over on YouTube. If you enjoy the episode be sure to subscribe to their feed and follow them on Twitter for updates when new shows are released.

tagged: phptownhall ep50 psr15 phpfig middleware anthonyferrara woodygilk beausimensen

Link: https://phptownhall.com/episode-50-low-down-on-psr15/

PHP Town Hall:
Episode 50: Low down on PSR-15
Jun 29, 2016 @ 14:20:22

The PHP Town Hall podcast has posted their latest episode (after a bit of hiatus) giving the low down on PSR-15, the proposed PHP-FIG standard for HTTP middleware.

n all star cast this episode, as Ben and Phil are joined by regular guest Anthony Ferrara - thinker of good ideas and long-time part-time side-line contributor to the PHP-FIG, Woody Gilk - one-speed rider & BDFL of Kohana, and Beau Simensen - author of a bunch of stuff including StackPHP.

Here we’re talking about some awesome stuff the PHP-FIG is working on: PSR-15 (HTTP Middleware). [...] We discuss all this, and the reason PSR-7 (HTTP Message) is not enough for the ecosystem to benefit from shareable middleware. [...] Woody provides a bit of the decision-making process in a very tricky aspect of the FIGs job, which is: should standards be built entirely to match existing implementations, or should standards try to improve on the learnings of the existing implementations to better them all as implementations change to support the standard. It’s all a bit chicken and egg, but a very worthy discussion to have.

You can catch this latest episode either through the in-page video player or directly on YouTube. If you enjoy the show, be sure to subscribe to their feed and get the latest as new shoes are released.

tagged: psr15 phpfig middleware proposal standard phptownhall podcast ep50

Link: https://phptownhall.com/episode-50-low-down-on-psr15/


Trending Topics: