Dependency Management and WordPress: A Proposal

I came across this article – “Dependency Management and WordPress: A Proposal“, which provides an excellent overview of some of the recent developments and discussions in the area of composer integration with WordPress, and even more generically, some of the issues around dependency management in an ecosystem as large and complex as that of WordPress.

It’s been a while since I checked what’s going on in this area.  A couple of years back, I linked to an article that shows a way to use composer with WordPress, and since then I’ve built something similar for our use at work.

But it’s good to see that the problem is not tossed and forgotten, and that there are some very smart people still trying to work it out.

Payum – PHP 5.5+ payment processing library

Payum – PHP 5.5+ payment processing library, which is self-described as:

It offers everything you need to work with payments: Credit card & offsite purchasing, subscriptions, payouts etc.

The documentation looks extensive, and the list of supported gateways is probably the longest I’ve seen.

Mautic: Open Source Marketing Automation Software

Mautic is an Open Source marketing automation software, which provides a whole bunch of functionality around contact tracking, campaign management, mass mailing, landing pages, and more.  It can be self-hosted or used as Software-as-a-Service (SaaS).  The source code is on GitHub and licensed under GPLv3.

It provides an API, and is already integrated with a whole lot of services, varying from social networks and instant messengers, to CMSes and CRMs.  Scroll down the Tour page for a comparison table against such alternatives as Marketo, InfusionSoft, Hubspot, Pardot, and Eloqua.

 

Creating Strictly Typed Arrays and Collections in PHP

This SitePoint PHP blog post (read at Planet PHP if the site is unavailable) brings to light a very useful feature available since PHP 5.6 – ellipses in functional arguments, which allows to define a variable number of arguments to a function.

I’ve seen the mentions of ellipses a few times now, but I assumed that it was a PHP 7 feature.  Turns out PHP 5.6 users can enjoy it as well:

<?php
function sum(...$numbers) {
    $acc = 0;
    foreach ($numbers as $n) {
        $acc += $n; 
    }   
    return $acc;
}
echo sum(1, 2, 3, 4); // prints out 10

This is very useful, but, as SitePoint PHP blog most mentions, it can be made even more useful with type hinting of the arguments.  For example:

<?php 
class Movie { private $dates = [];
    public function setAirDates(\DateTimeImmutable ...$dates) { 
        $this->dates = $dates;
    }   

    public function getAirDates() {
        return $this->dates;
    }   
}

The limitation is that you can only hint a single type for all the arguments. The workaround this is to use collection classes, which basically work as strictly typed arrays.

Shields.io – quality metadata badges for open source projects

Shields.io provides a large collection of badges that you can use in your project documentation (like README.md over at GitHub or BitBucket), which shows a variety of metrics for the project – latest version, number of downloads, build status, and more.  Pretty much anything that you’ve seen used by any project on GitHub is supported (I couldn’t think of a badge that wasn’t).

Now, if only there was a way to insert these things automatically somehow …