Steve Grunwell

Open-source contributor, speaker, and electronics tinkerer

Tag: PHP

Taco, a black cat, peeking out of a white drawer

The Beauty of PHP Value Objects

At last year’s php[tek], one of my biggest “holy cow, why haven’t I been doing this?!” moments came from my friend Andrew Cassell when he explained PHP Value Objects in the context of Domain-Driven Design.

Put simply, a Value Object is an immutable object that encapsulates some data and will always be in a valid state.

Continue reading→

Stacks of vintage, sepia-toned photographs

Paid Support for Legacy Libraries

A few weeks ago, I was talking to my good friend Eric Mann about an open-source package he maintains. This particular package has quite a number of downloads and active users, despite Eric trying to abandon it a few years ago. He’s since restarted development on it, but now he faces a problem: people are upset that he’s dropped legacy PHP version support.

This particular package is popular within the WordPress ecosystem, which is big on backwards compatibility. Despite the fact that both PHP 5.6 and 7.0 stopped receiving even security updates at the end of 2018, there are still plenty of users out there running their applications in old, insecure versions of PHP. As a result, some people were rather upset when Eric stated “I’m not going to spend my [limited] time supporting EOL’d versions of PHP.”

Some commenters were quick to jump in with remarks ranging from “well, it doesn’t take that much time to support older versions of PHP…” to “WordPress supports older versions of PHP, so should you!”, but Eric remained firm: if you want support for older versions of PHP, you can either pay me for my time or contribute the code yourself.

It may sound a little harsh, but I’m 100% with Eric on this one: he doesn’t owe anybody his time and effort. That’s time he could be spending with his family, out hiking, or working on projects that he enjoys. Heck, knowing what Eric can do, back-porting support for old versions of PHP should be way down on his list of priorities.

Continue reading→

The skyline of Austin, TX

Getting started with testing at Longhorn PHP 2019!

To my knowledge, Longhorn PHP was the only new PHP community conference in the US that I didn’t get to speak at last year — I was fortunate enough to speak at PHP Detroit (Detroit), Southeast PHP (Nashville), Cascadia PHP (Portland), and WavePHP (San Diego). In fact, I haven’t been outside of an airport in Texas since the final Lone Star PHP (the spiritual predecessor to Longhorn PHP) in 2017. That’s but one reason I’m excited to announce that I’ll be giving my Testing Like You’ve Never Tested Before (Because You Haven’t) talk at Longhorn PHP 2019!

Continue reading→

A basket full of assorted vegetables

Streamlining your test suite with PHPUnit Data Providers

In every testing talk I’ve attended (or given), there’s one stand-out feature that often has the audience saying “whoa, I had no idea you could do that!” No, it’s sadly not “hey look, you can reliably build quality software with a much lower chance of defects or regressions!”, but rather the inevitable use of PHPUnit’s Data Providers.

With Data Providers, our test suite can become more readable and maintainable while making it trivial to add new testing scenarios. Best of all? PHPUnit ships with Data Providers right out of the box.

Continue reading→

The Pacific coastline in San Diego at sunset

Speaking at WavePHP 2018

I’ve spent most of my life living in Ohio, and it’s a state I very much consider to be my home. However, after a trip to San Diego a few years ago while I was working at 10up, San Diego certainly entered the running. When I heard that a new PHP conference, WavePHP, was starting up in San Diegoat the same resort we stayed in for our team meetup (so I already know where the best tacos in the area are) — I knew I had to apply. Now, I’m finally able to announce that I’ve been accepted to speak at the first-ever WavePHP!

Continue reading→

Two small monkeys on a tree branch

Automatically Install PHP’s Runkit7 via Composer

A WordPress plugin I’ve been working on recently needed to be able to accept configuration in a few different ways: users should be able to define a constant in the wp-config.php file or fill out a form within a settings screen. If the constant is defined, the setting screen should be aware of that and hide the setting, since the constant should take precedence.

This is a pretty common pattern in WordPress plugins, but it can get rather tricky to test; by design, once a constant is defined in PHP, you shouldn’t be able to change its value. PHPUnit has ways to work around this by running tests that define constants in separate processes, but this can seriously impact the performance of your test suite. Furthermore, the WordPress core test suite is pretty tightly coupled, so it doesn’t like when tests are run separately.

Continue reading→

A Crash-course in PHP Namespaces for WordPress Developers

Way back in 2009, PHP 5.3 was released to the world and with it brought support for PHP namespaces — a way of easily separating your code from other developers’ code, which has since become the de facto way of encapsulating functionality across the PHP ecosystem.

With namespaces, multiple packages could use the same class and function names without conflict, because each one would operate in their own PHP namespaces. Unfortunately, many PHP developers who focus on WordPress development may be in the dark on this extremely useful language feature.

Continue reading→

Speaking (and eating hot chicken) at Southeast PHP

Last summer, Matt Trask took me to get my first taste of Nashville hot chicken at Hattie B’s. I was in Nashville for Music City Code, and Matt wanted to pick my brain about conferences: the good, the bad, and the…not so good. He revealed that he and some of the other members of the Nashville PHP community were in the early stages of planning a new conference: Southeast PHP.

Now, almost a year later, I’m proud to announce that I’ll be speaking at the inaugural Southeast PHP this August in Nashville, TN!

Continue reading→

Two Talks at the Inaugural PHPDetroit

I’m extremely excited to announce that I’ll be giving two talks this summer at the first-ever PHPDetroit conference in the Greater Detroit, MI area!

I usually keep it on the down-low (as a resident of Buckeye Country), but I was born in mid-Michigan before moving to Columbus, Ohio when I was three. Still, I spent lots of time visiting my Michigan family during summers and holidays growing up, so it’s pretty amazing to now a) be working for a Michigan-based company and b) get to visit Michigan semi-regularly for conferences like WordCamp Ann Arbor, Beer City Code, WordCamp Grand Rapids, and now PHPDetroit.

Continue reading→

The Atlanta skyline, taken from the Jackson Street Bridge.

I’ll be Speaking at php[tek] 2018!

I’m not shy about telling people that php[tek] and php[world] are two of my absolute favorite conferences. Both are organized as collaborations between php[architect] and One For All Events, and play host to some of the biggest names in the PHP ecosystem. That’s why I’m ecstatic to announce that I’ll be giving two talks at php[tek] 2018!

Continue reading→

Page 1 of 3

Be excellent to each other.