Blog Posts

Getting OpenSwoole and the AWS SDK to Play Nice

I have some content that I store in S3-compatible object storage, and wanted to be able to (a) push to that storage, and (b) serve items from that storage.

Easey-peasey: use the Flysystem AWS S3 adapter, point it to my storage, and be done!

Except for one monkey wrench: I'm using OpenSwoole.

Continue reading...

Exposing webhooks via mezzio-swoole

I was first introduced to the concept of webhooks via a 2009 blog post by John Herren, a former colleague at Zend. At the time, they were in their infancy; today, they're ubiquituous, as they provide a mechanism for a service to notify interested parties of events. This saves traffic; instead of consumers polling an API for event changes, the service notifies them directly. It also means that the consumer does not need to setup things like cronjobs; they instead setup a webhook endpoint, register it with the service provider, and their application takes care of the rest.

The thing is, handling a webhook can often lead to additional processing, and you are expected to send an immediate response to the provider indicating you received the event.

How can you achieve this?

Continue reading...

Running cronjobs via an Openswoole timer

Sites I build often utilize cronjobs to periodically pull in data from other sources. For example, I might want to poll an API once a day, or scrape content from another website once a month. Cronjobs are a perfect fit for this.

However, cron has a few problems:

  • If the job is writing information into the file tree of your web application, you need to ensure permissions are correct, both at the filesystem level, and when writing the cronjob (e.g., running it as the same user, or changing permissions on completion).
  • If you are running console tooling associated with your PHP application, you may need to worry about whether or not particular environment variables are in scope when you run the job.
  • In containerized environments, usage of cron is strongly discouraged, as it means running another daemon. You can get around this with tools such as the s6-overlay, but it's another vector for issues.

Since most sites I build anymore use mezzio-swoole, I started wondering if I might be able to handle these jobs another way.

Continue reading...

Caddy as a Secure Reverse Proxy

I've been using Caddy as a front-end reverse proxy for several years now, on the advice of Marco Pivetta. Somewhere along the line version 2 was released, and I updated at some point, but evidently didn't quite understand some of its configuration options, particularly around HSTS support and providing your proxied application information about how the client tried to connect.

Continue reading...

Tinker-like REPL for Mezzio

Today in the Laminas Slack, somebody asked if there was an equivalent to Laravel's Tinker REPL. The short answer is "no", but I had a suggestion for them.

Continue reading...

Laminas CI Automation

The Laminas Project has close to 200 repositories between the main project, Laminas API Tools, and Mezzio. It's a lot to maintain, and keeping on top of incoming patches can be a gargantuan task, much less creating releases.

That's why this past year, we've spent a bunch of time on streamlining our processes; we want to be able to review, merge, and release changes quickly and confidently. To that end, we have developed a number of GitHub Actions to make these processes as easy as possible for our maintainers.

Continue reading...

Development-Mode Modules for Mezzio

I fielded a question in the Laminas Slack yesterday that I realized should likely be a blog post. The question was:

Is there a way to register development-mode-only modules in Mezzio?

There's actually multiple ways to do it, though one that is probably more preferable to others.

Continue reading...

More Changes Coming for the Laminas Project

Progress has been happening at a furious pace on the Zend Framework to Laminas transition, with major changes still dropping even now.

Most recently, we decided to rename the subprojects. Apigility will become the Laminas API Tools, and Expressive will become Mezzio.

For more background, read the Zend by Perforce blog post.

Continue reading...

An Apology to php[world] Attendees

Due to disorganization on my part, I accidentally booked php[world] 2019 to coincide with a family commitment.

Continue reading...

Looking For A New Adventure

Update

As of 2019-10-01, I am once again employed full-time. Thank you everyone who reached out!

Fourteen years ago, almost to the day, I received a job offer from Zend to join their nascent eBiz team, where I started contributing almost immediately to the yet-to-be-announced Zend Framework. Two years later, I joined the Zend Framework team full-time. A year later, I was promoted to Architect. A year after that, I was promoted to Project Lead of Zend Framework, a role I kept for the next ten years. Over the years, Zend was acquired by RogueWave Software, which was in turn acquired by Perforce earlier this year.

Two months ago, almost to the day, was my last day with Zend/RogueWave/Perforce.

I'm now looking for a new adventure.

Continue reading...