Category archive: php
It seems like 2 or 3 times a year I need to throw together a simple static site for some reason or another. I usually end up writing a basic template and routing system to get the job done. Well, after rewriting this code probably dozens of times over the years, I’ve polished it up and sent it out into the world:
Hoist (Github)
Hoist (Demo & documentation)
Hoist is a great way of getting a site up and running without writing any code. You get simple templates, pretty URLs and you don’t have to worry about databases or bloated CMSes. And it’s written in PHP so it will work just about anywhere.
Hoist isn’t going to replace your favorite MVC framework, but it can probably save you an hour or two if you need to put together a website for your dog!
Stripe.com recently opened up to the public. It’s by far the best payment processing solution I’ve seen. The really nice thing about Stripe is that you don’t need a pain-in-the-ass merchant account to use it, you just hook it up to a regular checking account.
I just posted stripe-terminal, a super simple PHP/JS payment form that anyone with a website and an SSL certificate can use to process payments. This could be used as a starting point for Stripe integration, or just out of the box as a simple way to get paid (a freelancer sending a link with an invoice, a band using an iphone to sell merch at a show, etc).

Guilt by association: We Run The Game is running on some gallery software I wrote. The goal (and I guess there’s a pattern forming here) was extreme simplicity and speed.
According to the RSS spec, all of the dates in your RSS content should be in RFC 822 format. That means they should look like this:
Sat, 07 Sep 2002 09:42:31 GMT
Here’s a PHP function that will take a timestamp and give you that string:
function rss_time($time){ return strftime("%a, %d %b %Y %H:%M:%S %z", $time); }
…but I didn’t have much of a choice:
function parse_date_from_string($string=""){ $month_names = array("", "January","February","March","April","May","June","July","August","September","October","November","December"); $regex = "/(\d{1,2})[-|\/|\.](\d{1,2})[-|\/|\.](\d{2}|\d{4})/"; $date = array(); if(preg_match($regex, $string, $matches)){ $month = preg_replace("/^0/", "", $matches[1]); $date['month'] = $month_names[$month]; $date['day'] = $matches[2]; if(strlen($matches[3]) == 2) $matches[3] = "20" . $matches[3]; $date['year'] = $matches[3]; $date['string'] = trim(preg_replace($regex, "", $string)); } return $date; }