Introduction to automated, static code analysis in PHP

In my daily work one of my jobs is to assure code quality of our web applications written in PHP. Beside the usual checks like manual code review, training (e.g. using XP programming sessions) and automated unit tests using PHPUnit, there are some metrics that can be measured automatically making my work easier and helping to reduce error rates in the review process. In the following article I want to introduce the most common methods and tools addressing static code analysis in PHP.

FreeBSD Init-Script for the Caddy Webserver

I have used Caddy for a while now on FreeBSD. But though it lacks a working init script, I decided to write one on my own. Here’s the result, description below:

My Top 20 OS X tools

There are some tools that make a developers’ daily work much easier. Here’s my top 20.

Git: Delete merged branches

When using Git extensively, you’ll likely have multiple branches which need to be cleaned up from time to time. In some repositories I have hundreds of feature/, hotfix/ and release/ branches, which are already merged to the master branch and deleting them manually would be a mess.

So here’s how to delete all branches from the server, that are already merged to the master branch. In this case, branches need to start with either feature/, hotfix/ or release/ but you can simply adjust this to match your needs.

Simple mail forwarding using Postfix

It’s more than likely that your email provider of choice, especially the ones that offer mail services free of charge, will not support receiving email to custom domain names like, in my case, Running your own mail server would solve this problem but running a fully featured mail stack including POP, IMAP, Sieve filters et cetera requires a fairly powerful machine. Additionally, if not configured properly, there’s big potential for abuse, e.g. spam.

As an alternative, it’s possible to just run a MTA which redirects all incoming email to an external mail server. This can be ran on almost any machine, even on a low-budget computer like the Raspberry Pi or a cheap virtual server.

Simple Podcast-Downloader for Linux & BSD

During the last few months I managed to automate many recurring tasks on my NAS. One good example for those task is updating my podcast archive. I tried to accomplish this using a lightweight shell script which, running as a cronjob, would hold my podcast archive up to date and notify me about new episodes via push notifications.

Why use FreeBSD?

Often the question arises why one should prefer FreeBSD over any arbitrary GNU/Linux distribution, that is more widely spread and additionally offers commercial support. Though I have mostly positive experiences using Linux, there are many reasons why I would always choose FreeBSD for setting up a server.

Puppet Quickstart

In the following quick start guide I will show you the basic usage of Puppet. If you want to follow me along, you’ll only need the text editor of your choice (I’m using Sublime Text here) and a command line. Also you should be using a supported operating system, I’ll describe the installation exemplary on Fedora Linux and Mac OS X Yosemite.

Install old JDK versions (1.6, 1.7) in Mac OS X Yosemite

It’s already been while since Apple removed the “Java Preference Pane” from OS X, with which it was possible to change between various installed Java versions. I shortly needed to compile some old Java application against the JDK version 1.6 and I was questioning how to change the compiler version.

Install bower on Mac OS X

In this guide I’ll show you how to install the package manager Bower on Mac OS X. Bower is a NodeJS application, so you’ll need to install the Node Package Manager npm first. npm is available as a package in the Homebrew repositories.