Archive for the 'PHP' Category

Goodbye Ibuildings, hello Egeniq

A couple of years ago, when I joined Ibuildings, it was because I had a passion for PHP and the PHP community, and Ibuildings was THE company embodying this spirit. I’ve got the opportunity to work at some of the most amazing projects, and met some of the smartest people in PHP-land. However since about a year, I’ve noticed my interests shifting a lot to mobile and mobile development. Of course I’m still as passionate about PHP as I was a few years ago, but I feel that mobile development is quite close to web development in a couple of ways, especially nowadays when people often expect to have internet available at all times. After focussing more and more on mobile development and seeing a huge future in it, I decided it was time for me to move on and leave Ibuildings.

To better match my combined interest of PHP and mobile development, I decided to join Egeniq. For those who don’t know Egeniq, they’re an awesome mobile technology company, founded 7 months ago by my former colleagues PeterBas and Ivo. Other than your average mobile app shop, they focus on proper software engineering, architecture, performance and scalability. They build on the years of experience they have in the PHP world and bring that expertise to the mobile business. They’re also really into geek stuff, and mobile devices fit nicely into that category, too :-)

Even though deciding on leaving Ibuildings was probably the hardest career decision I ever had to make, I very much look forward playing around with all things mobile and working closely with my former colleagues again. Exciting! :-) I’d like to thank Ibuildings for the opportunities they gave me and all the wonderful people over there, from whom I’ve learned so much. I will be at Ibuildings until the end of April, starting at Egeniq at the start of May.

This is quite a big step, and I thought about taking this step for a long time. But you know you should pursue something, if you have a very strong gut feeling that you just need to do this. The feeling that, if you don’t do this, you will regret it. The feeling that you get when considering all the pros and cons, but deep down inside yourself you know you already made up your mind. It goes without saying that I’m very much looking forward to the new things to come at Egeniq!

Using git-svn: making the switch

A lot of people are already convinced that Git has a good chance of replacing Subversion as the version control system of your choice in the long run. Git is in most ways far superior to SVN (If you want to know why, have a look at this comparison). The feeling that Git is the way to go is only strengthened by the fact that major (PHP) projects are switching or planning to switch to the decentralized version control system: Zend Framework, phpBB, Symfony and Drupal, to name a few.

Lots of projects are still stored in SVN repositories though. It’s not always easy to switch from one VCS to another, often projects have SVN-specific build scripts or infrastructure in place. If you’re interested in using Git but you’re still tied to Subversion as your main version control system, you can do so with the git-svn bridge.

Note: this is not a git tutorial, I’m kind of assuming you’re already familiar with git and how to create, add, modify, delete, commit, diff and more. If you’re a bit unfamiliar with the git commands but know the svn toolset, have a look at this excellent svn to git crash course.

Git svn magic

git-svn – Bidirectional operation between a Subversion repository and git. The basic idea is that you keep your SVN respository in place (for as long as it will last), but still use git for all your day to day version control operations. When you feel like, you can then issue a command which will synchronise your git commits with the central Subversion repository. Let’s get started on the setup.

I’m assuming you have a traditional SVN repository layout with trunk in project/trunk, branches in project/branches/* and tags in project/tags/*. The -s switch indicated you want git svn to assume this layout is in place, so it can transform the repository paths to remote git repositories. The parameter --no-minimize-url is sometimes needed when you don’t have read permissions on the full repository, since git will try to connect to the root of the repository because sometimes, this provides better tracking of history when you’re importing the project. This step will initialize a git repository in the current directory with the needed metadata information to fetch the svn repositories later on:

$ git svn init -s

Next up, we’ll fetch the history from the svn repository and store it inside our git repository. An optional revision parameter (-r) can be added to only fetch history from that revision and up:

$ git svn fetch -r XXX

You can also replace the previous 2 commands with the command below. The only difference is that the git svn clone command creates a new git repository directory for you instead of using the current directory, hence the last parameter which indicates the directory name:

$ git svn clone -s project_dir

Updating from and committing to svn

When you do a git commit, these commits won’t be pushed directly to the svn repository. Interacting with the svn repository is done separately, so two additional commands are useful.
Updating your repo with the latest changes from SVN (similar to svn update):

$ git svn rebase

Pushing your commits to the SVN repository (somewhat similar to svn commit):

$ git svn dcommit

Basically, right now you’re set to go and you can start working on your git repository like you would normally do. In my case, I wanted to know how to do some additional things. They might not be needed in your case, but I found them useful to set up my working environment.

Working with branches

Since you have imported the git repository using a standard layout (remember the -s from the git svn init), you have all branches and tags available as you normally would with an svn checkout. Have a look at those remote branches:

$ git branch -r

Of course, you can start working on these branches too. To create a local branch which tracks one of the remote branches, do:

$ git checkout -b new_branch remote_branch
# so, for example to create a branch 'release_1.5' which tracks remote 'release_1_5':
$ git checkout -b release_1.5 release_1_5

When you fetched the SVN repository into your git repository, it automatically set your local master repo to follow the remote trunk repository. If you want to change that (for example, to have a branch as default master repo), you can change it like this:

$ git reset --hard remote_branch
$ git reset --hard release_1_5 # example

Fixing svn ignore

Svn ignores aren’t automagically transfered to your newly created git project, but git does have a similar way of ignoring files or directories inside a project. Better yet, git svn provides a built-in command which looks for svn ignores. If you then add those to .git/info/exclude (locally) or .gitignore (project-wide), you have exactly the same setup as you would have with svn.

$ git svn show-ignore > .git/info/exclude

Fixing svn externals

If you’re using svn externals, you might have to jump to some additional loops to set everything up. There’s no real replacement for svn externals, but one way Git manages to simulate this is by using submodules. Submodules are a bit cumbersome to set up, but luckily for us, there’s a script which searches your project for svn externals and checks them out as git submodules. Of course, it’s not guaranteed to work, but might make it easier to set it up. Get it here:

I’m hoping this is enough to get you started on using Git, an awesome version control system with too much cool features to name. If I’m missing something, please let me know in the comments and I’ll be glad to update the post.

phpDay Italia 2010

First things first: looking at the post date, it’s been more than a year since my last post. No excuses here, it’s just how it is. I’ll try to post a bit more often, but can’t promise anything :)

A while ago, I was invited to phpDay 2010 to speak about a subject I like a lot: Gearman. A PHP conference in Italy sounds pretty cool to me, my employer was sponsoring the conference and I’m always glad to give a presentation about topics I’m passionate about. Not surprisingly, I looked forward to phpDay 2010 quite a lot.

Continue reading ‘phpDay Italia 2010’

PHP UK Conference review

The past days I’ve been in London to attend the PHP UK Conference 2009. I’ve been to the previous edition which I liked very much and thanks to my employer, I was able to go to this year’s conference too.

No conference is a real PHP conference without the pre- and post-conference socials, and luckily we were spoiled in that part. Thursday evening, there was a pre-conference social in the Brook Green Hotel Bar. Already running in a bit late, we were just in time to see Derick be done with talking about dbus which was a shame, because I looked forward to that talk. Nevertheless, I got to see old friends and meet new friends, which made the social a success.

The conference day started with collecting our badge, which went pretty smooth. I went to check out the Ibuildings stand and got myself an Ibuildings shirt to wear. The opening speech by Marcus Baker had an original take to it, and made it clear that a reasonable amount of the conference visitors was from a foreign country. Some pictures were taken and promised to put online, but I’ve not heard from those since. If anyone knows where they are, please let me know!

Next up on stage was Aral Balkan with “The future’s so bright, I gotta wear shades”, a refreshing view on new trends and tools for developers. He’s got an energetic and playful way of presenting, which was received well by the audience. Through the talk, he definitely made his points across. Differentiation in development work is largely based on having fun in what you do and working on things you really get inspired from.

The next talk was David Sorria Parra on Sharding Architectures. This was one of the more advanced talks but at the same time one of the talks I looked forward to the most. David talked about different sharding techniques, describing the advantages and pitfalls of each. He concluded that consistent hashing is the best (and most scalable) approach to sharding, something I’m definitely going to look into a bit more.

David Axmark, one of the co-founders of MySQL, talked a bit about Drizzle. Drizzle is a database server optimized for cloud and internet applications. By focussing on for example scaling, multi-core support and high concurrency, Drizzle is on its way to become quite an interesting alternative to MySQL. David mentioned where the Drizzle project is today, explained some of the features and where Drizzle is heading. Although clearly far from usable for production, I’m very much looking forward to at least try it out. It also opens up a lot of possibilities for writing plugins, which is a cumbersome task in the current MySQL distribution and made a lot easier with Drizzle.

After skipping a track (well not really, the hallway track is quite interesting too :) ), my collegue Stefan Koopmanschap was ready to deliver a talk on symfony. With “MyPHP-busters”, Stefan busted some of the myths that the Symfony framework has been suffering from. All of his points were certainly valid, and the presentation as a whole looked very nice. Kudos to Stefan for this one.

To close the day off, I saw Chris Shiflett talk on Security Centered Design. This must have been the one presentation I was underestimating the most. By regularly applying psychology patterns to security and user interface design, Chris emphasized there’s much more to developing an application than only functionality. This is certainly a topic that appeals to me, maybe even enough to have a look at the book recommended by Jon Gibbins: Defensive design for the web.

After the open bar provided by MySQL/Sun, we went off to the bar again to have the post-conference social, to conclude a nice conference. Congrats to the PHP UK organizers, you succeeded in having a great and enjoyable conference with lots of interesting talks. You can expect me again next year.

Speaking at IPC Spring edition 2009

My upcoming conference schedule:

I’ll be doing a talk there titled: “PHPT: Lessons learned from PHP TestFest”. If you want to know the ins and outs of PHPT and testing PHP Core, this might be of interest to you.

See you in Berlin!

Setting up phpUnderControl

On a regular basis, I get contacted by people who want to install phpUnderControl but don’t really know how to set up their projects and use the features provided by phpUnderControl completely. So, aside from providing a quick-and-easy setup guide for cruisecontrol and phpUnderControl, I’ll share the setup scripts I have here and hope it’s useful for someone. This guide is mostly focussed on getting phpUnderControl to work on a Debian system, but there’s not that much OS specific to it.

Getting it installed

You probably will need some tools that are related to the PHP project you want to deploy on the phpUnderControl installation and for the sake of briefness I’m not going to cover how to install them, but instead just list what might come in handy for the continuous integration system to set up:

$ apt-get install subversion subversion-tools sun-java6-jre sun-java6-jdk

Also, install php, phpdoc, phpcs, phpunit and xdebug, you’ll need it later on for unit testing, generating reports and analyzing your code. Next up, you can install cruisecontrol. Just get the cruisecontrol archive and unpack it somewhere. (I chose /opt):

$ cd /opt/
$ wget
$ unzip /opt/
$ mv -f cruisecontrol-bin-2.8.2 cruisecontrol

By default, cruisecontrol doesn’t have a start-up script. That’s not very easy when you want to start, stop or restart the server, so let’s make it (in /etc/init.d/cruisecontrol):

. /lib/lsb/init-functions
test -x $DAEMON || exit 5
UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true
case $1 in
log_daemon_msg "Starting Cruisecontrol server" "cc"
if [ -z "$UGID" ]; then
log_failure_msg "user \"$RUNASUSER\" does not exist"
exit 1
cd /opt/cruisecontrol/
./ > /dev/null 2>&1
log_end_msg $?
log_daemon_msg "Stopping Cruisecontrol server" "cc"
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
log_end_msg $?
rm -f $PIDFILE
$0 stop && sleep 2 && $0 start
pidofproc -p $PIDFILE $DAEMON >/dev/null
if [ $status -eq 0 ]; then
log_success_msg "Cruisecontrol server is running."
log_failure_msg "Cruisecontrol server is not running."
exit $status
echo "Usage: $0 {start|stop|restart|force-reload|status}"
exit 2

Set the file to have executable rights, and start the cruisecontrol server:

$ chmod +x /etc/init.d/cruisecontrol
$ /etc/init.d/cruisecontrol start

Right now, if you go to http://yourhost:8080/dashboard/, you should see a working cruisecontrol server page. If you don’t, please have a look at the previous steps and try again. A quick look at the cruisecontrol logs in /opt/cruisecontrol/cruisecontrol.log to find out what might be the problem.
For now, you can stop the cruisecontrol server:

$ /etc/init.d/cruisecontrol stop


This is even easier to install. We’ll just take the bleeding edge SVN sources so we can enjoy the latest goodies that phpUnderControl has to offer :) :

$ cd /opt/
$ svn co svn:// phpuc
$ /opt/phpuc/bin/phpuc.php install /opt/cruisecontrol
$ /etc/init.d/cruisecontrol start

That’s it! phpUnderControl should be installed by now, which you can verify by going to http://:8080/cruisecontrol/ and see the new phpUnderControl interface. Of course, there’s not much information available at this time, let alone a useful project. But we’ll get to that in a minute :)


All phpUnderControl projects are configured in a single config.xml file, located in the cruisecontrol install directory, in our case /opt/cruisecontrol/config.xml. To give you an idea on how this looks for most of my PHP projects, here’s an example:

<project name="phpfoo" buildafterfailed="false">
<plugin name="svnbootstrapper" classname="net.sourceforge.cruisecontrol.bootstrappers.SVNBootstrapper"/>
<plugin name="svn" classname="net.sourceforge.cruisecontrol.sourcecontrols.SVN"/>
<currentbuildstatuslistener file="logs/${}/status.txt"/>
<svnbootstrapper localWorkingCopy="projects/${}/source/"/>
<modificationset quietperiod="0">
<svn localWorkingCopy="projects/${}/source/"/>
<schedule interval="60">
<ant anthome="apache-ant-1.7.0" buildfile="projects/${}/source/build.xml"
target="build" uselogger="true" usedebug="false" />
<log dir="logs/${}">
<merge dir="projects/${}/build/logs/"/>
<currentbuildstatuspublisher file="logs/${}/buildstatus.txt"/>
<artifactspublisher dir="projects/${}/build/coverage" dest="logs/${}" subdirectory="coverage" />
<artifactspublisher dir="projects/${}/build/api" dest="logs/${}" subdirectory="api" />
<execute command="/opt/phpuc/bin/phpuc.php graph logs/${}"/>
<htmlemail mailhost="xx.xx.xx.xx" returnaddress=""
returnname="phpUnderControl server" logdir="logs/${}">
<failure address="" reportWhenFixed="true" />

As you can see, this file actually just looks out for changed subversion modificationsets, updates the source and then fires off the build.xml inside the project source directory. That one is actually the most interesting one, so I’ll list it here too:

<?xml version="1.0"?>
<project name="phpfoo" default="build" basedir="../">
<target name="php-documentor">
<exec executable="phpdoc" dir="${basedir}/source" logerror="on">
<arg line="-o HTML:frames:DOM/earthli -ti '${} documentation' -dn default -i tests/
-s on -ue on -t ${basedir}/build/api -d ." />
<target name="phpcs">
<exec executable="phpcs"
output="${basedir}/build/logs/checkstyle.xml" dir="${basedir}">
line="--ignore=*/tests/* --report=checkstyle
--standard=PEAR source" />
<target name="phpunit">
<exec executable="phpunit" dir="${basedir}/source/tests" failonerror="true">
line="--log-xml ${basedir}/build/logs/phpunit.xml
--log-pmd ${basedir}/build/logs/phpunit.pmd.xml
--log-metrics ${basedir}/build/logs/phpunit.metrics.xml
--coverage-xml  ${basedir}/build/logs/phpunit.coverage.xml
--coverage-html ${basedir}/build/coverage
AllTests" />
<target name="build" depends="php-documentor,phpcs,phpunit" />

This builds API documentation, runs the PHP Codesniffer and runs the unit tests, which in turn provides the code coverage, metrics, PMD and other statistics. That’s all there is to it!

Dutch PHP Conference 2009 dates!

As ever, I’m excited for a new year, and with that comes a new year of PHP conferences. Last year, the Dutch PHP Conference really amazed me with their speakers, talks, organization and location. I got to know exciting new technologies, met a lot of new friends and got to see old friends again. Add the amazing social events (that was a memorable football match, france vs the netherlands!) to the mix and you get the recipe for a superb PHP conference.

Of course the good folks at Ibuildings will be organising the Dutch PHP Conference (DPC) again in 2009, and the dates are known! So grab your agendas and put a big mark on June 11-13 2009 (that’s right, 3 days of conference goodness!). That’s all there is for now, but more details will undoubtly follow.

One thing that I’m particularly proud of: last year I could only admire a company that provides professional PHP services, is very active in the PHP community and delivers a top-notch PHP conference. This year however, I can say that since recently, I’ve joined Ibuildings. Seeing how they are engaged in enterprise PHP and everything around it makes me feel glad about the choice I’ve made to join ’em.

Seven Things – Tagged by Ivo

To my surprise I got tagged by Ivo and while it is the cool thing to say that you don’t like these tagging memes, I’m going to accept this one with pleasure! Here are seven things you may not know about me:

  • I actually started out as a linux system engineer after high school, but decided to start an education in graphical digital design. Within one year I knew for sure that I didn’t want to design all my life, but still continued to get my degree. The second I finished school, I returned back to linux stuff and (PHP) development.
  • I love to cook and enjoy a good glass of wine. For this, I’m still concidering some sort of cooking class.
  • For about 8 years, I played the piano (starting when I was 5 year old), violin and saxophone. Unfortunately, I didn’t find the time to continue this, but I’d love to pick up playing piano at some point.
  • When I was younger, I was sure I was going to be a paleontologist, and I collected and read about anything I could put my hands on about paleontology and dinos.
  • My first experience with PHP was on a summer job, where they needed a site + CMS. I figured I’d learn PHP on the way and somehow PHP was flexible enough for me to pull it off and deliver a working site.
  • I’m quite a fan of jazz music, this is mainly influenced by my dad, who enjoys playing jazz piano. Thelonious Monk is one of my favorite jazz artists.
  • I always thought breaking something would be a very cool experience (because of the adrenaline boost and such), but I did come back on that opinion when I broke my arm 2 times in 4 months time.

Right now about anyone in the PHP is already tagged so I’m going to go with people that didn’t yet write their seven things and hope this blog post gets published before they do. And besides, they’re just all nice guys too :-)

  • Helgi Þormar Þorbjörnsson – because he likes to say meow (and also because he likes PEARs)
  • Marcus Boerger – For his work on SPL, and enjoyed meeting him at ZendCon ’08
  • Ralph Schindler – For getting up at around 5am for helping out on our Bughuntday
  • Pierre-Alain Joye – For helping me out with starting to write PHPT tests
  • Christian Flickinger – For letting me meet the Double double animal style burger at ZendCon ’08
  • Johannes Schlüter – Because I want to see if he’ll actually do this :)
  • Thijs Feryn – Because I hope he will again start a blog and share his ideas with the rest of us

And here’s the rules I’m supposed to pass on to them:

  • Link your original tagger(s), and list these rules on your blog.
  • Share seven facts about yourself in the post – some random, some wierd.
  • Tag seven people at the end of your post by leaving their names and the links to their blogs.
  • Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.

Ibuildings announces ‘PHP Center of Expertise’

Ibuildings, the PHP professionals, had another great announcement to make today. Being the innovative company they are, they announced the ‘PHP Center of Expertise’. Ibuildings has a lot of very talented, community-involved people working over there and they have a great way of interacting with that PHP community through support for user groups and organizing conferences or seminars. And that’s where the PHP Center of Expertise kicks in to bring those activities to the next level.

The PHP Center of Expertise (which isn’t a definitive name) will deal with all activities that involve PHP expertise, knowledge or community interaction. For example (from the Ibuildings blog):

  • Contributing to/supporting open source projects
  • Supporting user groups/communities
  • Organizing conferences/seminars
  • Developing training material
  • Forming and maintaining partnerships
  • Developing professional services

About every point on the list is already something I’m loving to do in my spare time, and to see that Ibuildings is actually serious enough about those subjects to start a whole new department for it is great. I see fun initiatives where community members could actually cooperate to produce a knowledge platform that helps everyone in the PHP community forward. Michelangelo van Dam already suggested doing podcasts, to give an example.

They already rock in being the number one PHP development and services company, and it’s just refreshing to see that they give back to the community in such a way. It’s a kind of mindset that you don’t encounter much with similar companies, but Ibuildings does it and is pretty successful in it. I’m curious to see the new expertise center initiative grow in the coming months!

Agile development with the Agilo for Scrum Trac plugin

Trac is a well known issue tracking system with an integrated wiki, version control browser and more. It allows for a more streamlined development process with software tickets, changeset views and roadmaps. An excellent fit for helping with PHP application development, for example.

Now, agile development has certainly proven its use in the PHP world, but imho lacks a good tool to track everything that surrounds it. We’re talking about a way to manage user stories, requirements, tasks, time tracking, sprints, product and sprint backlogs, all in a preferably web-accessible way. The only ways I know of before are using Excell or the Phprojekt Scrum addon (which I honestly didn’t try yet, I’m not (yet) familiar with Phprojekt). Some weeks ago though, I stumbled on Agilo for scrum.

Agilo for scrum is a Trac plugin that uses the issue tracking system and extends it with features that enable you to follow a more agile development process. It’s still in early beta, but looks very promising already. It’s got an Apache Software License 2.0 so you can always have a look under the open-source hood ;-) Installation is possible with a python egg, so you can easy_install the whole thing, provided you have the needed dependencies (matplotlib and the python imaging library, to name a few). After setup, Trac is modified quite substantially so let’s have an overview.

The main change is the new dashboard link, which hosts some nice graphs on the sprint burndown and displays resolved or open tickets.
This is an example of such a burndown graph:
Dashboard chart

Below the charts, the available actions and reports are displayed. Actions include creating requirements, tasks, user stories or bugs. Reports are for example the product backlog and sprint backlog. The great thing about the changed issue tracking is that it’s now possible to build relations between different registered issues. This way it’s possible to have a user story with different tasks linked to it.
Every task now can be assigned to be fixed for a certain sprint:

User story

Different Trac users can be assigned to development groups and the amount of possible spendable hours can be set on a per-day basis for each developer. This way it’s possible to see how much time something should need and how much developer time there’s still available to implement a feature.

It’s a pretty sweet enhancement to Trac, and although it isn’t totally ready for production use (yet), it’s worth to have a look and test it out, you might like it! More information can be found on the agile42 website.