Andho's Blog

About Information Systems

Talking About Composer, a Package Manager for PHP

There has been hype building around Composer and I am hyped about it. It’s main user base is coming from within the Symfony community and looking at it’s code, you can see the Symfony influence in it. And I tell y’all, this tool is pretty cool.

Composer is really more of a dependency manager and can be (usually is) used withing a project to define it’s dependencies, and makes it easier for other developers to get those dependencies easily with a single command. It is not so mature yet but the development is rapid.

I also mention an idea I have about using composer for installing PHP toolsets. Read on.

CQRS Command Testing With PHPSpec

In this tutorial "hypothetical tutorial" I am going to show you how to use PHPSpec to test your commands using gherking language style tests, or in layman’s terms Given-When-Then style test. A final test written in this way will look like this:

Junit.xml Formatter for PHPSpec, Compatible With Jenkins

I needed a Junit Formatter

Currently I am doing my testing using PHPSpec, and Continuous Integration using Jenkins CI. As PHPSpec doesn’t currently have Junit.xml output format the XUnit plugin for Jenkins cannot show the test results, so I set out to create a Junit Formatter for PHPSpec.

There was already a feature request for a Junit Formatter on the PHPSpec github page. And a user named xenji (who also made the request) had started to work on it, so I decided to check it out. I pulled the changes from his repo and ran my tests with -f j, which indicates that I want the output in junit format and I got a plain text result. So I checked the source and it was just a skeleton mostly. As I needed the Junit format really soon I started to hack on this.

Command Query Responsibility Segregation in PHP - CQRS

I’ve been playing around with CQRS recently and the pure simplicity of the concept and what it brings to the table is astounding. I have been contemplating about how I would go about implementing the domain architecture for a new project that I would be starting soon. The first decision I made was that it will be done using DDD, making the domain explicit in the code. But then how will I implement DDD. I drew diagrams, studied the current systems, etc.

Setting Up a Manageable KVM Host – Part 2 – Easy Cloning

This is part 2 of a 2 part series (forgot what part 3 was about). In this post I’ll be explaining how you can setup a virtual machine specifically for cloning. I cannot remember where I got the information about the ssh keys and interface rules and I would like to say sorry that I cannot attribute it.

Getting to Know PHP Namespaces


Namespaces has been introduced in PHP since version 5.3, and it has been gaining traction over the months. It’s not just namespaces but all the features of PHP 5.3 is catching on and helping developers move forward from where they were stuck before.

Setting Up a Manageable KVM Host - Part 1 - Using LVM for Storage

This is going to be a three part series (maybe more, maybe less) highlighting different aspects of KVM that I have found difficult to setup and how I managed to solve them.

What’s KVM and why use it?

KVM stands for Kernel-based Virtual Machine, "a full virtualization solution for Linux on x86 hardware containing virtualization extensions" - KVM home, and is now part of the Linux kernel. As you might know, most linux distros are choosing KVM as their virtualization technology. This makes it the best option if you are just getting into the virtualization domain.

Log Monitoring With Graylog2 on Ubuntu 10.10

When you get to a point where you are managing several application/web servers, you will come to understand that it is quite often that you have to go through the different logs that you have on each server. Maybe you want to troubleshoot a crash or you want to find cases of intrusion.

Update: Found a great post about logging: Advanced logging in Linux.

Behavior Driven Development With PHP and PHPSpec Web Runner

Behavior Driven Development, BDD for short.

If you have been using PHPUnit for Unit Testing you already know the benefits of automated testing and once you get used to setting up Unit Tests for your code it gets easier. Now PHPUnit is great if you are following Test Driven Development, but if you want to write even more verbose code you could use BDD.

In BDD the Unit tests are the documentation. You write the class names and methods of the unit test exactly as you would write a requirements specification for that functionality, and this will make tests itself the documentation for the project.

Modifying Private or Protected Properties in Php

Yes it is possible and many of you might already know this. But I have searched for this a couple of times and never crossed this solution except until recently.

Now, when you talk about modifying private or protected properties you should be aware that these properties are private or protected for a reason. So I would like to tell you that this should be done only when it is absolutely necessary. This kind of code is not the kind of code that you come across when your strolling around the php street. This is inside that black forest that you see at the horizon.