Evert PotBlogging for 10 years! (28.5.2016, 20:27 UTC)

10 years ago today I first started this blog. I guess at this point it might be the longest running ‘thing’ I’ve ever done. Back then I had never been on an airplane, but since then I’ve blogged from every continent except Antartica.

Although blogging isn’t nearly as cool as it used to be, and twitter has largely replaced RSS, I’m happy to say it’s still going strong and it’s still fun!

I had some of my most read posts this year, but sadly I noticed that there’s a very obvious correlation between popularity and writing somewhat low-effort opinion pieces. My most popular post was pretty much about how I hate LinkedIn, which got around 23000 page views. Articles like that completely drown out the ones I actually care about, but on the upside, that particular post actually got me 4 new customers for my freelance work.

Technology wise I’ve gone from a custom solution, to Habari, eventually landing on Github Pages + Disqus. Disqus has become more and more social media and less ‘comment box’ and they added some dark patterns, so if you have a different recommendation I’d love to hear it! Especially if I can import from Disqus. But I love Github pages (except when they upgrade jekyll and throw non-descript errors). The static markdown approach to blogging makes so much sense, but I miss scheduling posts in the future.

Since this year this blog is also running on HTTPS via the HTTP/2 protocol. You gotta practise what you preach after all! This is provided via Cloudflare, which is a nice service and free if your needs are simple.

Anyway, one thing I have to say is… I’m extremely happy that I’ve started this all this time ago. Twitter is nice, but my blog archive gives me an awesome archive on what things interested me over the years. The blog has opened many doors, including jobs and gigs and sometimes just getting the benefit of the doubt.

It’s by far been my most useful career development tool.

Note: This post was written and was supposed to be posted on the 25th, the actual birthday of this blog, but in an ironic twist of faith, github pages decided not to publish it with a cryptic error.

SitePoint PHPPhinx – the Migration Library You Never Knew You Needed (27.5.2016, 16:00 UTC)

You're building an application, and you need to share the database's structure with your team. After all, you want everyone to be up and running as soon as possible. What do you do? SQL dumps of table structures? You could... but that's so very primitive - and can be time consuming to import, too! More often than not, database migrations are the answer.

In this tutorial, we'll go through a framework-agnostic package for building and executing database migrations called Phinx.

Phinx logo


First, let's install Phinx into the project with Composer:

composer require robmorgan/phinx

The Phinx binary will be installed into the vendor/bin folder, as per Composer's default values. It can then be executed by running:

php vendor/bin/phinx

Phinx needs a phinx.yml file from which to read the database configuration before it can do anything meaningful. To generate it, we run:

php vendor/bin/phinx init


The generate file will look something like this:

    migrations: %%PHINX_CONFIG_DIR%%/db/migrations
    seeds: %%PHINX_CONFIG_DIR%%/db/seeds

    default_migration_table: phinxlog
    default_database: development
        adapter: mysql
        host: localhost
        name: production_db
        user: root
        pass: ''
        port: 3306
        charset: utf8

        adapter: mysql
        host: localhost
        name: development_db
        user: root
        pass: ''
        port: 3306
        charset: utf8

        adapter: mysql
        host: localhost
        name: testing_db
        user: root
        pass: ''
        port: 3306
        charset: utf8

Phinx supports an arbitrary number of "databases", though these should be considered version of one database rather than several different ones. Sometimes, the need may arise to use a completely different database, however.

Such is the case, for example, with nofw, which in a previous version still uses Gatekeeper - a secure but clumsily developed user authorization package. Gatekeeper demands its own phinx.yml file (with a custom migration path) and does not provide an option to change which one is used, while at the same time requiring its own user database. That throws a wrench into the whole "let's use Phinx in a project already using Gatekeeper" idea.

For cases like these, Phinx offers the -c option which tells the launcher which phinx.yml file to use. Note that Phinx supports json and php file formats, too, but we'll focus on the default yml one here and create a separate file for our example database.

Continue reading %Phinx – the Migration Library You Never Knew You Needed%

PHP: Hypertext PreprocessorPHP 5.5.36 is available (26.5.2016, 00:00 UTC)
The PHP development team announces the immediate availability of PHP 5.5.36. This is a security release. Several security bugs were fixed in this release. All PHP 5.5 users are encouraged to upgrade to this version. For source downloads of PHP 5.5.36 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.
PHP: Hypertext PreprocessorPHP 5.6.22 is available (26.5.2016, 00:00 UTC)
The PHP development team announces the immediate availability of PHP 5.6.22. This is a security release. Several security bugs were fixed in this release. All PHP 5.6 users are encouraged to upgrade to this version. For source downloads of PHP 5.6.22 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.
SitePoint PHPFinding Differences in Images with PHP (25.5.2016, 16:00 UTC)

I recently stumbled across a fascinating question: how could I tell whether an image had changed significantly? As PHP developers, the most troublesome image problem we have to deal with is how to resize an upload with an acceptable loss of quality.

Two similar images with hidden differences

In the end I discovered what many before me have - that this problem becomes relatively simple given the application of some fundamental mathematical principles. Come along with me as we learn about them...

You can find the code for this tutorial at https://github.com/undemanding/difference.


There are two popular ways of thinking about images. The first is as a grid of individual pixels, composed of varying levels of color and contrast. Commonly, we break these colors down into their constituent red, green, and blue values. We could also think of them as hue, saturation, and lightness.

The second way of thinking about images is in terms of vectors. A line isn't the pixels in between but rather a starting point and an ending point, with some meta data that describes a stroke in between. We're going to focus on bitmaps because they'll make the whole process easier.

We can break any image down into this bitmap grid, with code resembling:

$image = imagecreatefrompng($path);
$width = imagesx($image);
$height = imagesy($image);

$map = [];

for ($y = 0; $y < $height; $y++) {
    $map[$y] = [];

    for ($x = 0; $x < $width; $x++) {
        $color = imagecolorat($image, $x, $y);

        $map[$y][$x] = [
            "r" => ($color >> 16) & 0xFF,
            "g" => ($color >> 8) & 0xFF,
            "b" => $color & 0xFF

Given the width and height of the image, we can use a function called imagecolorat (on an image resource) to get a single integer value for the red, green, and blue at that pixel. We can then use bit shifting and masking to get the individual values of each from the single integer value.

Continue reading %Finding Differences in Images with PHP%

Nomad PHPSymfony Console Component (25.5.2016, 15:06 UTC)

Speaker: Juan Manuel Torres @onema Did you know that PHP can be used to create Command Line Interface (CLI) applications? In fact, CLI support was officially added in version 4.3.0 more than 13 years ago! This talk will guide you through the basics steps to create, configure, run, and test your own CLI application using …

The post Symfony Console Component appeared first on Nomad PHP.

Brandon SavageWhy I write, maintain and use my own framework (and you should too) (25.5.2016, 12:00 UTC)

Note: The recommendations in this post are intended for a very advanced audience. While the content applies broadly, creating and maintaining your own framework is not advised for everyone, unless you know exactly what you’re doing. For many of us in the PHP community, our identities are as much tied into the framework we use […]

The post Why I write, maintain and use my own framework (and you should too) appeared first on BrandonSavage.net.

PHP ClassesPHP and JavaScript Innovation Award Report May 2016 Edition - February 2016 nominees (25.5.2016, 04:33 UTC)
By Manuel Lemos
This is the May edition of the Innovation Award podcast hangout recorded by Manuel Lemos and Arturs Sosins to comment on the outstanding features of all the past month nominees and winners PHP and JavaScript packages, the prizes that the authors earned, starting with the nominees from the month of February 2016.

Listen to the podcast, or watch the hangout video to learn why the nominated packages were considered to be innovative, as well the current rankings of the Innovation Award Championship by author and by country.
SitePoint PHPPlease: Automated CMS and Framework Installs in Vagrant (24.5.2016, 22:00 UTC)

If you're a web developer, possibly one of your most boring and repetitive tasks is the configuration of the basic setup for every new project. Configuring your my-project.dev domain, creating the database, installing WordPress (or any other CMS/Framework) for the thousandth time: you already know how to do it. What if you could automate all of that?

Well, actually, you can.

Please is a simple bash script that helps to automate the installations of many CMSs and Frameworks by configuring them automatically into your Vagrant box, adding a development domain name into your host file, and even a database if needed.

Let's take a look.

Important Notice

Since Please is still in beta version (0.3), I suggest that you not use it immediately in your production, but to test it first --- to make sure everything works as you require. There's no risk about losing data and so on --- the worst thing that could happen is that it's not working --- but it's always better to be safe.


So, first, you need to setup a Vagrant box.

If you're new to Vagrant, I suggest you read this nice introduction to understand the whole thing and get started the right way.

A small Vagrant box (a fork of box.scotch.io) has been created for this project, and it's named Please Box.

Here are all the steps for installation:

$ git clone  https://github.com/jehanf/please-box.git please-box
$ cd please-box
$ vagrant up

Please also requires the Vagrant HostsUpdater plugin to get everything to work. The installation is quite simple; here's the command to save you some time:

$ vagrant plugin install vagrant-hostsupdater

That's it, you're all set to start using Please!

Install Please

There are very few steps needed to install Please, as written in the official documentation:

$ git clone  https://github.com/jehanf/please.git
$ sudo chmod +x please/please
$ sudo mv please/please /usr/local/bin/please && sudo rm -R please

The && sudo rm -R please part is only to keep your computer clean; since the git clone part clones the full folder of the repo, including the README file, you may not want to keep these on your computer.

Continue reading %Please: Automated CMS and Framework Installs in Vagrant%

Christian WeiskeTYPO3: Oops, an error occurred! (24.5.2016, 17:43 UTC)

On your TYPO3 production machine (TYPO3_CONTEXT=Production) an extbase plugin crashes and only leaves a cryptic message:

Oops, an error occurred! Code: 201605240939366c16aa1f

If you did not modify TYPO3's error handling , the real error message is logged by TYPO3\CMS\Core\Log\Writer\FileWriter into typo3temp/logs/typo3_*.log.

This does of course not help if you don't have SSH access to the live server. The exceptions also do not follow normal error flow - which means a docker logs -f does not show it, and they will also not show up on your log server.

To fix this, overwrite the default configuration in typo3conf/AdditionalConfiguration.php:

// configure default logger to log to nginx error log
// so that we'll see this in graylog
     'writerConfiguration' => [
         \TYPO3\CMS\Core\Log\LogLevel::WARNING => [
             \TYPO3\CMS\Core\Log\Writer\PhpErrorLogWriter::class => []

Do not try to put this into typo3conf/LocalConfiguration.php; TYPO3 will merge it with the default config, leaving you with both FileWriter and PhpErrorLogWriter. TYPO3's default configuration is defined in typo3/sysext/core/Configuration/DefaultConfiguration.php.

LinksRSS 0.92   RDF 1.
Atom Feed   100% Popoon
PHP5 powered   PEAR
ButtonsPlanet PHP   Planet PHP
Planet PHP