Setting Up CakePHP with IIS

Published on Jun 11, 2013 by Jamie Munro

I’ve found myself doing this several times over the past little while as I had to switch computers.  Each time I would struggle with a few of the steps, so I thought I would document them this time and share for future me (or you if you like).

Read more >

Tags: CakePHP | php | PHP | mysql | iis | CakePHP

What Do You Care Most About When Reviewing Someone Else’s Code?

Published on Jun 10, 2013 by Jamie Munro

I wrote an article a few months ago called Compelling Interview Questions where buried deep in the middle under several open-ended technical questions I asked the question “What Do You Care Most About When Reviewing Someone Else’s Code?”

The funny part about this when you read a few lines below I follow it up with I’m not looking for anything in particular; just some generic catch-phrases that most people throw out there.  E.g. properly indented code, no large comment blocks, documentation to explain a complex block of code, etc…

Ask me today what I expect from this question and my answer is totally different!  Today being as I write this article – ask me in the present and let’s see if my answer changes…

Read more >

Tags: Optimization | php | socket server | PHP | interview | Rants | clean code

Implementing the Repository Pattern with CakePHP

Published on Jun 3, 2013 by Jamie Munro

I must admit, my recent articles are becoming a bit obsessed around the repository pattern.  What can I say, I like it, it’s useful, and it’s not restrictive based on a language or a framework.

I’ve long professed how I dislike convoluted controllers.  CakePHP’s find method almost immediately causes this when used inside a controller.  More importantly, the code inside the find method is extremely unreadable.  This is almost more important than a large controller function!

This is where the repository pattern comes in.  At its most basic example (which some will consider overkill – you know who you are), I still think the repository pattern is clearer.

Here is an example using the regular find approach:

$user = $this->User->find('first', array('conditions' => array('id' => $id)));

Compared to a repository example:

$user = $this->UserRepository->GetById($id);

The code is almost identically; however, in the second example, it’s clear that if I were to “read” the code I am retrieving a user by id opposed to I’m finding the first user with the conditions of id being equal to the variable $id.

So if you are sold, let’s continue with a full suite example…

Read more >

Tags: CakePHP | PHP | repository | CakePHP

Recent Guest Posts on

Published on Jan 7, 2013 by Jamie Munro

I've had the pleasure of being a guest writer at a fantastic site called  This site is a subsidiary site to one of the most popular technology blogging sites

The first article I wrote is an excellent extension of the various CakePHP articles I've written about in the past.  It discusses a variety of ways to improve the speed of CakePHP applications.  The latest article (that was just released a few days ago) discusses creating your very own OAuth server.  Since OAuth2 is still in a draft state, the article is for creating an OAuth1 server.

In case you are not a regular of this site, here is a quick preview of the articles.

Read more >

Tags: CakePHP | php | PHP | oauth | CakePHP

PHP: Single Quotes versus Double Quotes

Published on Oct 9, 2012 by Jamie Munro

I always enjoy doing interviews and asking potential candidates what the difference between single quotes and double quotes are in PHP.  Most people have the basic understanding that single quotes are not interpreted by the compiler whereas double quotes are processed while the page is being executed.  The follow up question is typically which one they prefer; this answer is always 50/50.  I have always been a fan of single quotes thinking them to be faster…

Read more >

Tags: Optimization | php | speed comparison | Theory | PHP | quotes

Upgrading my Blog - The Final Saga!

Published on Sep 24, 2012 by Jamie Munro

The Best Way to Prevent SQL Injection

Published on Sep 19, 2012 by Jamie Munro

CakePHP 2.x Login System

Published on Sep 18, 2012 by Jamie Munro

A Short Rant About Coding Conventions

Published on Sep 13, 2012 by Jamie Munro

What I Learned This Summer

Published on Sep 7, 2012 by Jamie Munro

It's LEMP not LAMP!

Published on Sep 6, 2012 by Jamie Munro

PHP: Require/Include vs Autoloader

Published on Aug 29, 2012 by Jamie Munro

The flaws of using isset()

Published on Apr 8, 2009 by Jamie Munro

Re-map key/value array data in PHP

Published on Mar 19, 2009 by Jamie Munro