Tag: php
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.
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.
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.
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.
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.
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.
An Apology to php[world] Attendees
Due to disorganization on my part, I accidentally booked php[world] 2019 to coincide with a family commitment.
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.
Managing Multiple PHP versions via the ondrej/php PPA
Last week, I did some system updates, and then decided to compile the most recent PHP releases. I've used phpbrew to manage multiple PHP releases for a number of years, and having it install a new version is fairly routine.
Except this time, it wasn't. Due to updates I installed, I was getting errors first with compiling the GD extension, then with ext-intl:
-
If you want Freetype support in ext-gd, you are expected to install the package libfreetype-dev. On Ubuntu, this now installs libfreetype6-dev, which no longer includes the
freetype-config
binary that PHP'sconfigure
script uses to determine what features it supports. -
Similarly, ext-intl depends on the package libicu-dev. Ubuntu's package now omits the
icu-config
binary used by PHP to determine feature support.
I searched for quite some time to find packages that would resolve these problems. I could have found the source code and compiled it and linked to that, but that would mean keeping that up-to-date on top of my PHP installs.
I even looked in the ondrej/php PPA, as that repository has multiple PHP versions already, including source packages.
And then I thought: why not try using those instead of phpbrew?
The rest of this post is how I made that work.
From Zend Framework To The Laminas Project
Ten years ago this month, I was involved in a couple of huge changes for Zend Framework.
First, I helped spearhead integration of the JavaScript library Dojo Toolkit into Zend Framework, and finalized the work that month. I'd worked closely with the two developers who had been leading that project at the time, and one thing that came up during our discussions was that they had helped create an open source foundation for the project, to ensure its continuity and longevity, and to ensure the project can outlive the ups and downs of any commercial company. This idea intrigued me, and has stuck in the back of my mind ever since.
The other thing that happened that month was that I was promoted to Project Lead of Zend Framework. I've held that position ever since.
Today, I get to announce another change: Zend Framework is transitioning to an open source project under the Linux Foundation!