From the blog
Posted 2023-12-14
From the blog
Posted 2018-10-16
Have you used Node.js?
For those of my readers unfamiliar with Node.js, it's a server-side JavaScript
framework that provides the ability to create, among other things, network
services. To do so, it provides an event loop, which allows for such things as
asynchronous processing.
In the PHP ecosystem, a group of Chinese developers have been creating an
extension that provides many of the same capabilities as Node.js. This
extension, called Swoole, allows you to create web
servers with asynchronous capabilities. In many cases, the asynchronous
capabilities are handled via coroutines, allowing you to write normal,
synchronous code that still benefits from the asynchronous nature of the system
event loop, allowing your server to continue responding to new requests as they
come in!
We've been gradually adding and refining our Swoole support
in Expressive, and recently
issued a stable release that will work with any PSR-15
request handler. In this post, I'll enumerate what I feel are the reasons for
considering Swoole when deploying your PHP middleware application.
From the blog
Posted 2018-01-23
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!
From the blog
Posted 2017-03-30
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.