Skip to content

DC4D: 50 for 50

Dear Reader,

Ok, many of you that know me know that I run Day Camp 4 Developers. DC4D is a virtual conference designed to help developers take their career to the next level.

Our next DC4D event is part of our PHP Master Series and it’s titled “Deep Dive into Unit Testing”. We have four awesome speakers covering a wide spectrum of knowledge all related to Unit testing your code.

Batting cleanup for us is none other than Chris (GrmpyProgrammer) Hartjes himself. Chris is well known in the PHP community as one of the leading experts in Unit Testing. Chris has 2 great books out on the subject “The Grumpy Programmer’s Guide To Building Testable PHP Applications” and “The Grumpy Programmer’s PHPUnit Cookbook“.

The point

“Deep Dive into Unit Testing” is approaching the 50 ticket mark. I was talking to Chris about that this morning and he made this challenge.

If we sell 50 tickets or more to this event, I’ll give everyone coupons for 50% off both my books.

So I’m taking him up on it. Here’s my pitch to you.

  • If Unit Testing is important to you and your team
  • If you like saving money
  • If you’d rather spend the Friday before Christmas learning than pretending to work. (oh don’t look at me like that, it’s the FRIDAY BEFORE CHRISTMAS!)

Join us. Register for Day camp 4 Developers, or register your team for an Office Party. Order the Pizza, pour the Mountain Dew, kick back and learn. After it’s over, we’ll send you an email so that you can continue the learning with Chris’ books and save 50%.

Join us for DC4D: Deep Dive into Unit Testing on Dec 20th, 2013.

Until next time,
I <3 |<

Signaling PHP in action

Dear Reader,

No, this is not me announcing a followup book. :) This is just a quickie to point out that Matthias Noback wrote a blog post a little bit ago titled “Symfony2: Add a global option to console commands and generate a PID file”. In it he discusses Appendix A of “Signaling PHP” that talks about creating PID files.

Here’s the obligatory quote:

In Appendix A of “Signaling PHP”, Cal writes about a way to extend a Symfony command to automatically create such a PID file before executing its task, and to delete this file afterwards. In the example code in the appendix the command gets to choose the filename of the PID file. However, since a PID file is only useful for external applications that handle starting and terminating the command, you may want to let the location and name of the PID file be determined by the external application itself. In other words, you’d want to be able to run a command and use an option to determine the location of the PID file:

app/console my:command --pidfile=/home/matthias/

I’d like every command in my application to have this extra option. Unfortunately there is no standard way to do this with Symfony. So the first thing we need to do is find a way to globally add an option to the Symfony console application. Let me give away the clue: I did some research and found a way to do this. It is a bit of a hack, but not too bad a hack, since I don’t think it will break anywhere in the near feature.

The blog post goes on to shows a better way to handle the naming and location of the PID files, as well as how to make it a seamless part of all your commands.

If you work with symfony from the command line, this blog post is an excellent read and full of cool code. Check it out.

Thanks Matthias! :)

Until next time,
I <3 |<

Signaling PHP

Dear Reader,

PrintI’ve just finished my 3rd book – and my first mini-book – and wanted to tell you about it.

“Signaling PHP” is about using PCNTL signals like SIGINT in PHP command line scripts.

Most of the PHP I write these days is CLI scripts. I really wanted to be able to trap signals in some of my scripts. I struggled with this for a while; I even spent an entire weekend googling and reading only to find out that most of the information out there was either wrong, confusing, or incomplete. I decided that once I figured it out, I was going to put everything I learned together in one place to help others that were struggling with this topic as well.

So it is that I present to you “Signaling PHP”. The book is approximately 30 pages long, and is available in PDF, Kindle, and mobi formats.

You can get your copy by visiting

Until next time,
I <3 |<

Supporting Phil Sturgeon’s Charity Ride

Dear Reader,

Those of you who know me know that I run Nomad PHP. In June, we had my friend Phil Sturgeon speak on the PHP framework Laravel. Nomad PHP pays all of it’s speakers 1/2 of each ticket sold. That amount however, did not go far enough in helping Phil reach his goal to raise $7,000 as he participates in the “Braking AIDS Ride”.

So, to help Phil get closer to meeting his goal, I’m going to make this offer. If you did not see Phil’s talk, “Laravel 4: Yet Another Framework… but different” and you wanted to see it, or you just want to help Phil make a difference in the fight against AIDS, donate $10 or more to Phil’s ride and I will give you access to the recording of his talk.

Here’s how this is going to work. DON’T SEND ME ANY MONEY. Go to this link and make a donation. Then, forward me the email you get from the site confirming your donation. (Remove any sensitive data, I just need to see the date, amount, and confirm it came from them)

I will then send you a link and a password that you can use to watch Phil’s talk as many times as you like.

If you saw Phil’s talk and you just want to help him reach his goal, that’s cool too, he has a list of offers on his blog post to entice you.

Until next time,
I <3 |<

p.s. Could you do us a favor and tweet this around to your friends? We’d all appreciate it. :)

Using 3rd party libraries in Composer projects

Dear Reader,

Recently, I discussed a lesson I learned about “Managing the Verbosity of symfony’s Command Object With a Trait” while building a project. This particular project has been very instructional to me so I thought I would share something else I learned.

As discussed in the previous post, this is a command line script to move email addresses from eventbrite events into MailChimp lists. I wrote it specifically for use with my NomadPHP project but the way it now works, it operates on all my projects at once.

A problem I ran into when starting this project is that the official MailChimp API wrapper for PHP is NOT a Composer package. Thankfully, the wizards behind Composer have thought this through. To facilitate using non-Composer packages in composer projects, all I had to do is add one line to my “autoload” section of my project:

    "autoload": {
        "psr-0": {
	   "NomadPHP": "app/"},
 	   "classmap": [ "src/"]				  

The classmap section allows me to drop any class file into the directory src/ and then run composer.phar update. Composer will look at the files in that directory and add them to vendor/composer/autoload_classmap.php. Mine now looks like this:


// autoload_classmap.php generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'Eventbrite' => $baseDir . '/src/Eventbrite.php',
    'MCAPI' => $baseDir . '/src/MCAPI.class.php',

Problem solved. As you can see I also used this to be able to use the eventbrite API wrapper as well.

If you are not using Composer for your projects, you really need to start. It’s a great way to speed your PHP development.

Until next time,
I <3 |<