A Workflow for Modern WordPress Plugin Development

I had previously worked on a WP plugin framework that was intended to support PHP5.3+ and thus be usable by most WP developers. I never really completed it, getting hung up on the ORM, which I wanted to be an abstraction over the combination of WP objects + meta as well as potentially backed by regular DB tables.

Anyway, the reason I bring this up is I did have one idea in there that I thought was pretty good. I had a Loader which would loop through all of the services registered with the application container. For any service that has a HasActions or HasFilters interface implemented, it would automatically bind those services methods to WordPress’s actions & filters. Long-term, I wanted to add support for managing said bindings via annotations, so you could declare a class, annotate the methods on the class with the relevant actions and filters, register it with the container, and it would automatically be bound to the WordPress filters, making it easy to implement object-oriented services without having random closures around and binding to actions in constructors or whatever, making it easier to test these services.

I bring this up cuz I always thought it would be a cool idea, but because I wanted to support PHP5.3, I couldn’t implement the annotations, as it would probably rely on doctrine/annotations and require some newer PHP features to make work. However, it might fit in quite well with the approach Acorn / Clover is taking.

Is this something you might be interested in adopting? I could extract the Loader & related interfaces and implement the annotations-based binding I was considering.

2 Likes