Alexander develops more for a hobby than a job. Most of his sites are created with Joomla, but for specific projects he prefers the Laravel MVC framework. Alexander is also a developer of the FluxBB forum software.

Alexander's articles

  1. Personal Packagist with Toran Proxy

    Most of you reading this already know Composer. For those who don’t, you can read a previous article of mine before contuing. We can all agree that Composer has brought many good things into the PHP world. If one dares however to look for drawbacks, or better put, not included features, he could state that it is not possible to work with private repositories. That argument won’t hold anymore, since there is Toran Proxy.

    The end of the Satis era

    Before Toran, those that really wanted to use private repositories, could use Satis. Satis enables you to generate a privately hosted Packagist website, with mirrored repositories and your own private repositories. It was compatible with private projects on bitbucket and github and guaranteed security by usage of SSH keys. By mirroring the packages you are using (hosting them on your own server) you will get faster download speeds. Satis was a fine solution but about a month ago Toran was released as a better alternative.

  2. Fractal: a Practical Walkthrough

    If you ever developed for an API, you might have had troubles with changes of your database schema. If you didn’t happen to have a good implementation, you had to rework your whole model when changing some column names. In this article I will demonstrate how you can use Fractal as a layer between your models and JSON output. This post will show you how this package will make API development easier.

    Fractal as a package

    Fractal is a project written in PHP, and part of The League of Extraordinary Packages. These packages all comply to several requirements, like usage of PHP-FIG and Unit Test coverage. Fractal is mainly developed by Phil Sturgeon and still receives regular improvements. It can also be used with Composer.

    Setting up an environment

    For demonstration purposes, I will now set up a framework using Silex and Illuminate/Database (the ORM component of Laravel). It doesn’t matter if you don’t have any experience with one of those. The things I will do are very straightforward and I will explain them as much as I can. If something is unclear do not hesitate to leave a comment.

    I will now set up a framework. Note that if you don’t want to follow the steps, you can download all the code at the end of the article. Now start with creating a new folder inside root folder. We’ll start with creating our composer.json file, with all the dependencies that we need. In our case: Silex and Illuminate\Database. Create a composer.json file like this:

        "require": {
            "silex/silex": "~1.2",
            "illuminate/database": "*"

    Install the packages with composer install.

    The database

    I will take the example of an online music database. The database will provide information for several songs: the songname, the artist name, artist website, album name, release date and music label. In the beginning this will all be in one table. If you want to try it out yourself download the file 1.sql from this article’s repository and run it on your database.

  3. Time Complexity of Algorithms

    If you are a web developer or a programmer in general, you have most likely written algorithms for various tasks. Examples are: searching through a table, sorting an array of numbers by descending value, calculating the shortest path to get to a location… But what qualifies an algorithm to be a good algorithm?

    One specification of an algorithm is its correctness. You will probably assume that your algorithm works after testing it out a few times. However, if you can mathematically prove that your algorithm will work as expected for every input value possible, this is a huge bonus. I will not go further in to that subject in this writing.

    Another specification is its efficiency: how does the computing time relate to the amount of input? Is it a linear relation? Does computing time rise exponentially for the doubling of input? That’s what this article will be about.

    Time Complexity

    Time complexity is, as mentioned above, the relation of computing time and the amount of input. This is usually about the size of an array or an object. Time complexity also isn’t useful for simple functions like fetching usernames from a database, concatenating strings or encrypting passwords. It is used more for sorting functions, recursive calculations and things which generally take more computing time.

    This is not because we don’t care about that function’s execution time, but because the difference is negligible. We don’t care if it takes 10ms instead of 3ms to fetch a username. However, if we have a recursive sorting algorithm which takes 400ms and we can reduce that to 50ms, that would be an interesting thing to do.

    As you might guess, the lower the computing time, the more efficient the algorithm is. The question that follows is: ‘how can we define time complexity in an universal way?’. That’s where we’ll use the ‘Big O notation’.

    Big O notation

    The Big O notation is a notation for the time complexity of an algorithm. It is a mathematical representation of the upper bound of the limit of the scaling factor of the algorithm. For example, if we double the size of an input array, by how much does the computing time increase? This might become clear with two examples:

    $numbers = array(14,82,4,0,24,28);
    foreach($numbers as $number)
        echo $number;
  4. Using cURL for Remote Requests

    If you need to make remote requests from your PHP scripts, cURL is a great tool for the job, and the PHP extension offers the same functionality as the console utility but in the comfortable world of PHP. This article explains how to use the cURL extension, discussing GET and POST requests, handling login cookies, and FTP.

  5. PhalconPHP: Yet Another PHP Framework?

    From full-stack frameworks to micro frameworks, there’s a wide offering of PHP frameworks to choose from. And they all claim to be special, too. But Phalcon really is quite different compared to the others! This article takes a brief look at what Phalcon looks like and what makes it so special.

  6. A First Look at React

    For the past couple of years, Node.js has been drawing increasing amounts of attention as a promising web technology. While it has some strengths, like being event driven, some people just want to stick to PHP. If you’re one of them, you might want to take a look at a similar project for PHP named React.

  7. What’s New in Laravel 4

    The Laravel developers have been hard at work contributing some major improvements to the framework. Testability isn’t a problem any more, and neither is decoupling. Laravel 4 very well may be one of the greatest PHP frameworks currently available thanks to their hard work… so check out what’s new!

  8. Getting Started with Fuel CMS, Part 1

    This entry is part 1 of 2 in the series Getting Started with Fuel CMS

    When you hear the abbreviation CMS, you probably think about Drupal, Joomla, and even WordPress. However, there are alternatives to those heavy hitters if you want something more lightweight or flexible. If you’re look a simple administration interface, or integrate custom application code into the site, then it might be worth your while to explore Fuel CMS. This part of the two-part series looks at Fuel CMS in general and how to create pages and views.

  9. PHP Dependency Management with Composer

    Maybe you’ve experienced the pain of working on a PHP application which uses third-party libraries and then trying to keep them and their dependencies up to date. If so, Composer can soothe your pain. It can get you the libraries you want at the versions you need. Dependency management can be a hassle-free experience using Composer!