Tag: Projects

Xoket: The Learning Framework

February 16, 2012 » Geek

If you are new to it, frameworks are confusing, and just hard. Books and tutorials help, but there’s still a lot of “magic” going on in the background. This is good if you can treat it as a black box, but it’s better if you can find out what’s going on in there.

To this end, I have decided to write a framework, piece by piece, from scratch.

This framework does not have delusions of grandeur. I don’t expect anyone to actually use it in production, that is not what it’s for.

This framework is about learning and sharing. I’m going to blog my way through every component, as I build it, and keep a full history in github. I’m not going to lie, there will be mis-steps, but you’ll be able to see it all evolve commit by commit.


Principles are a good place to start – here are some for Xoket (zah-ket)

1. Documentation

As stated above, documentation is essential. PHPDoc formatting will be used.

2. MVC

Xoket will be a single request, MVC framework. HMVC is popular, but in the interest of complexity, we will not be implementing multiple request.

3. Explicit is better than Implicit

Taking a queue from The Zen of Python I will try to write explicitly, instead of using implicit magic. Unusual technique will be commented and discussed.

4. Modular

As much functionality that can be moved out of the core, should be kept out of the core. Auto-loading will be PSR-0 compatible, but also include some cascading functionality similar to Kohana.

5. Modern

Xoket will be designed for PHP 5.3 and higher. If you aren’t running modern PHP you should, there really isn’t a good excuse.

Getting Started

That’s the outline of Xoket – my next post will be about the early implementation of, well, whatever I decide to write first.

New Design!

February 5, 2012 » Geek, Life

After six years of sameness, I finally redesigned the blog.

While I was at it, I made it responsive, so it should look good on mobile too.

Responsive Layout

Some content is bound to still look funny as I haven’t reviewed all of it, but for the most part I think it looks good!

Special thanks to @johnhenrymuller for design help and my cool new logo.

Skunk: A stinky PHP microframework

November 18, 2011 » Geek

Six months ago I wrote a little PHP framework as an exercise. I’d been down this path before with the now abandoned Xoket – but this time I decided to go small, and throw away.

Hence Skunk was born.

Skunk is a single file, very lightweight API. Really, it’s just a borrowed router with some sugar wrapped around it.

I was after a Sinatra or Bottle feel, and I think I got something rather nice out of it.

Skunk uses anonymous functions extensively, so use PHP 5.3+ to save yourself the pain of create_function.


Here is a super simple Skunk application:

Let’s tear that apart.

Everything in Skunk revolves around the Skunk object, so we need to set one up.

While it is possible to have multiple Skunk objects, there really isn’t a good use case I can think of. But we won’t restrict your cleverness with a singleton.

The two most important functions for Skunk are get and post.

These functions take a route and a function to apply when that route is matched, in a GET request and a POST request respectively.

In this chunk we are setting up a GET request, with the route /hi(/<name>), so that will match /hi, /hi/John, etc.

Note the identifier <name> in the route. This named match will be captured and sent as an argument to the function.

Skunk route functions always need to take a reference to the Skunk object as their first argument. Following that are any other arguments that might be pulled from the route itself.

In this case we are just setting the body of the Skunk response.

This kicks off the request process and also renders the response.

Other Tricks

Skunk has some other features too.

You can raise a variety of errors inside of a request:

You can set headers:

There is even a little hook system, so you can do middleware-ish stuff:


So that is Skunk.

It could use some love, but it’s workable. We’ve run Number Laundry on it with no problems for four months with no problems yet.

For an example of Skunk in action, check out Number Laundry’s source at github.

Thursday Quote: Des Traynor

July 7, 2011 » Geek

“Scope should be restricted by budget, illness but should never be expanded to consume the budget.”

– Des Traynor
Where to draw the line?


June 22, 2011 » Geek, Life

Three months ago we made some cheese:

Today we tasted it:

Turns out we didn’t get it squeezed out enough, so there was some milky leakage.

It’s definitely not Monterrey Jack, but it’s pretty good.

Soft and spreadable, and fairly sour/bitter. It would be good with a nice summer sausage.

Tags: ,