PSR-14: Compound Providers

Submitted by Larry on 3 April 2019 - 10:45am

In part 3 of this series we looked at the more common patterns of Providers that may be used with a PSR-14 Event Dispatcher. In part 4 we looked at some more complex cases of Providers. Today, we'll bring them all together: Literally.

Recall that a Provider is responsible only for receiving an Event and returning a list of callables that it believes should be invoked on it, in the order it decides (if it cares). How it does that is up to the implementation. In fact, it's not even required to do so itself at all. A Provider can defer that decision to another Provider if it wishes, or, critically, to multiple Providers.

Continue reading this post on SteemIt.

PSR-14: Advanced Providers

Submitted by Larry on 1 April 2019 - 11:34am

In part 3 of our series we looked at some common Provider patterns for PSR-14. But the flexibility and complexity of Providers is limited only by your imagination. Today we'll look at a few more interesting examples of Providers that are all equally valid but tailored to particular use cases.

Continue reading this post on SteemIt.

PSR-14: Being a good Provider

Submitted by Larry on 30 March 2019 - 11:00am

As mentioned back in part 1, PSR-14 splits the core mediator into two objects: The Dispatcher and the Provider. The Dispatcher is fairly straightforward and most implementations will be fairly simple and fairly similar.

Providers are the exact opposite; A Listener Provider has one requirement: It maps the Event object into an iterable of callables, in the order it chooses. How it does that is left up to the Provider to define, and there are dozens of possible ways.

Continue reading this post on SteemIt.

PSR-14: All about Events

Submitted by Larry on 28 March 2019 - 11:03am

In the last installment we discussed the overall structure of PSR-14. Today I'd like to dive into the key aspect of any event system: The Events themselves.

Various different event systems structure events in different ways. Some require that it be an object. Others it's any arbitrary value. Others it's any number of arbitrary values, depending on the Event. Some really really want pass-by-reference arrays.

For PSR-14, we chose to standardize on an object and always an object. There were three main reasons for that:

Continue reading this post on SteemIt.

PSR-14: A Major Event in PHP

Submitted by Larry on 26 March 2019 - 10:44am

The PHP Framework Interoperability Group has released a number of new specifications in the last year. The latest, PSR-14, covers Event Dispatching. Like many PSRs it's a fairly small spec, at the end of the day, but intended to be high-impact.

In this series of posts I want to cover what PSR-14 is and does (and what it isn't and doesn't), and how to best leverage it in your projects as it gets deployed more widely.

Continue reading this post on SteemIt.

In defense of the office

Submitted by Larry on 24 February 2019 - 2:49pm

It is trendy these days to extol the virtues of remote working, and either implicitly or explicitly shame any company/manager that doesn't like it. While there are absolutely advantages to remote work or working from home, the one-sidedness of the conversation is, I believe, actively harmful. The idea of "going to work" is still a valid and useful one, and one that should not be cavalierly cast aside in Twitter snark the way it currently is.

Continue reading this post on SteemIt.

When I started writing PHP...

Submitted by Larry on 12 February 2019 - 7:46pm

I don't know exactly when I started writing PHP. It was shortly after the start of my second quarter of my freshman year of college, when a newly-met friend of mine introduced me to PHP as an easier to understand alternative to Perl. That puts it, I think, somewhere in January or February of 1999.

20 years ago, give or take a week. I have been writing PHP for two decades. That's more than half my lifetime. I feel old.

I thought it would be amusing (mostly at my expense) to look back a bit on just how much the PHP world has changed in the last two decades.

Continue reading this post on SteemIt.

Announcing API Problem 3.x for PHP, complete with PSR-17 support

Submitted by Larry on 24 November 2018 - 6:06pm

After a longer than intended delay, I'm happy to announce the 3.0 release of my Crell/ApiProblem library.

ApiProblem is a small, self-contained library for modeling IETF RFC 7807 "Problem Details" messages. (I know, more gibberish.) That is, it makes it easier for PHP developers to build a message for their API servers to handle cases where Something Bad Happened(tm).

Continue reading this post on SteemIt