We pioneered a pattern for exception handling for Zend Framework back as we initially began development on version 2 around seven years ago. The pattern looks like this:
ExceptionInterfacefor each package.
What this gave users was the ability to catch in three ways:
I've been running redis in Docker for a number of sites, to perform things such as storing session data, hubot settings, and more.
I recently ran into a problem on one of my systems where it was reporting:
Can't save in background: fork: Out of memory
I've been working on building PHP Docker images for the purposes of testing, as well as to potentially provide images containing the Swoole extension. This is generally straight-forward, as the official PHP images are well-documented.
This week, I decided to see if I could build Alpine-based images, as they can greatly reduce the final image size. And I ran into a problem.
For the past thirteen years, I've been either consuming Zend Framework or directly contributing to it. Since 2009, I've operated as project lead, and, since then, shepherded the version 2 and 3 releases, added Apigility to the ZF ecosystem, and helped bring middleware paradigms to the mainstream by assisting with the creation of Stratigility and coordination of the Expressive project. As I write this, the various ZF packages have been downloaded over 300 MILLION times, with 200 million of those being in the past 18 months!
Have you used Node.js?
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.
The last week has been my first foray into GraphQL, using the GitHub GraphQL API endpoints. I now have OpinionsTM.
The promise is fantastic: query for everything you need, but nothing more. Get it all in one go.
But the reality is somewhat... different.
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!
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?
Contract-based approaches use interfaces. I think you can see where this is going.
We all know the standard HTTP request methods and status codes, right? Or do we?
We definitely know whether or not they should be integers or strings, and/or how string values should be normalized, right?
And our IDEs can totally autocomplete them, right?
Oh, that's not the case?
I've been trying to automate everything this year. When working on OSS, this is usually as simple as setting up Travis CI; in some cases, even that becomes a little more involved, but remains possible.
But that's continuous integration. What about continuous development?