Installing nginx on OS X Yosemite

As always, there are many ways to accomplish this. My approach is based on Homebrew and assumes that you have it installed. If not, then the first thing you have to do is to install it. Installing nginx on OS X To install nginx, simply open up the Terminal and enter the following command. brew

ZF2: Accessing View Helpers in Controllers

Generally speaking, view helpers should not be used within controllers, as the name suggests. Certain situations may, however, require one to do so. This article shows you just how to do that by fetching the view helper manager from the service manager. It is actually very simple. public function someAction() { $userData = ‘User data

Adding Query Parameters with ZF2 URL Helper

In a view script in Zend Framework 2, one may need to generate an URL for a given route that includes one or more query parameters. For instance, when browsing through a paginated data set, one may want a form’s action attribute to point to the current page, such that the user will end on

Installing the mcrypt PHP extension on OS X

As with any PHP extension, the mcrypt extension can be a bit tricky to install. This guide is meant to simplify this task, and most of the work will be done in the Terminal. Before beginning, please ensure that you have Xcode installed, which can be found in the App Store as well as the

Using Google Visualization with wkhtmltopdf

The wkhtmltopdf tool, which converts HTML markup to a PDF document, is quite powerful compared to most other solutions that I have come across. It uses the WebKit rendering engine, which powers many Mac OS X applications such as Safari – and previously Google Chrome. This article shows you how to make the Google Visualization API work with the wkhtmltopdf tool.

How to use DocBlock Templates in PHPDoc

Sometimes one has several variables that are related – typically in a class – and one wants to document them with PHPDoc. Defining the same type and perhaps description for each of these variables or constants can be tedious and result in a lot of redundant documentation. Luckily, PHPDoc provides a way of documenting multiple

Installing the PHP intl extension on OS X Mavericks

Sometimes one needs to use internationalization features in PHP. It might be that a library that you are using depends upon the PHP intl extension – for instance, some validators in Zend Framework 2 do so. This article will show you how to install the things you need by hand. It has been tested on

Composer: Autoloading Libraries Without Namespaces

Autoloading third party libraries in PHP has become much less of a pain since the introduction of Composer. In this article we will see how this can be done for libraries that do not comply with the PSR-0 autoloading specification.

Introduction to PHP Generators

With the release of PHP 5.5, so-called generator functions are now available. Generators can among others be used to decrease the memory usage of your web server. This article gives you an overview of the generators in PHP 5.5.

Calculate Age From Date of Birth in MySQL

If you have ever needed to calculate the age of someone based on their date of birth, then you might have been left puzzled at first. Many people seem to over complicate things, so in this article, a simple function is provided to convert dates to ages.