PHP ClassesNotable PHP package: Move Me GIF (30.5.2016, 20:04 UTC)
By Manuel Lemos
Animated GIF images became popular because they allow to display videos on social network sites that only support image formats.

Assembling an animated GIF is just composing a sequence of still pictures. However, this class goes further to assembling pictures as animated GIFs by allowing to render sequences of images overlaid on top of custom background images.

It also provides optimization methods to generate smaller GIFs files by clipping regions of the images and skipping frames.

Read this article to learn more details about how this notable PHP package works.
SitePoint PHPSourcehunt: Conferences, Oauth2 in Slim, Static Analyzers, Etc. (30.5.2016, 17:00 UTC)

Hello there, hunters! Before getting into this month's links you should star and / or contribute to, I'd like to briefly give a shoutout to two conferences I attended and participated in this month: OSCAL and PhpKonf. Skip this section if you're just interested in this month's link list.

Sourcehunt logo

Conference Season

In Europe, May is usually chock full of conferences, and this one was no exception. While I do like to go as an audience member, too, (and so should you) the two instances I was at had me over as a speaker, and that was exceptionally fun.


Like last year, OSCAL was organized by our very own Elio Qoshi and his team, and took place at Tirana's university. A free conference dedicated exclusively to open data and open source, OSCAL can be considered south Europe's answer to FOSDEM. Much smaller in scope but in no way lacking dedication, this year's edition featured more tracks than ever, covering everything from data and media codes, to animal adoption via open source and bitcoin, even coding workshops.

All people

Aside from being superbly organized, OSCAL is far too humble about something one doesn't see often - if ever - at such generally tech-oriented events. Not only are most of the volunteer staff female, but the percentage of women in the audience is just jawdropping. I had wondered why that was since last time I was there (it's a regular occurrence, not a phenomenon). Could be the fact that women have been an important part of Albania's culture since the olden days (every painting in the history museum has a woman in a position of importance, or at least alongside a man)...


... or it could be the fact that it's a less PC environment and people just shrug off what they don't like, so there's no tension around social interactions, or a number of other things. I certainly hope the organizers will collect some post-conference data around this and let us know - in any case, I wasn't the only one surprised by this.

Continue reading %Sourcehunt: Conferences, Oauth2 in Slim, Static Analyzers, Etc.%

PHP ClassesPHP Articles Report May 2016 Edition (30.5.2016, 06:09 UTC)
By Manuel Lemos
This is the May edition of the podcast hangout recorded by Manuel Lemos and Arturs Sosins to comment on the latest outstanding PHP Articles published recently.

They commented on articles about using a plugin to insert charts and graphs on WordPress posts, how to prepare to technical interview for jobs, 10 aspects on which BitBucket is better than GitHub, converting HTML to PDF using an API, using Microsoft Visual Studio as your PHP IDE with PHP Tools extension, and the main changed and new functions in PHP 7.

Listen to the podcast, or watch the hangout video to learn more about these PHP articles.
Sarfraz AhmedFast MySQL Backup and Restore (29.5.2016, 13:57 UTC)

Backing up and restoring MySQL database is generally trivial task however when database is huge, it is really a pain to do so because of amount of time it takes to perform backup/restore operation with conventional tools like PHPMyAdmin or similar.

If you have SSH access to server, we can leverage built-in MySQL commands mysqldump and mysql respectively to backup and restore big database really fast.

To Backup Database:


To Restore Database:


Note: If you don't have SSH access, you can use tools like MySQLDumper which does fairly good job but not as fast as mysqldump and mysql commands of course.

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 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 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


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.

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