[chris-allen-lane.com] Programming | Security | DIY

Tag: php

Making Wordpress Domain-agnostic

I like Wordpress a lot. It's one of my favorite open-source projects, and I use it often for both my professional and personal projects. It's been my go-to web development framework for a number of years now.

There's one thing I don't like about Wordpress, though: the domain to which a Wordpress site is deployed is saved as a setting in its database. I don't think that was a good design decision, because it makes it painful to move a Wordpress site from one domain to another. This shortcoming is especially evident if you're trying to develop a Wordpress site on one domain, but would like to deploy to another. (For example, I always set up my local sandbox such that the WIP lives at example.dev, while deployments are pushed to example.com). I really wish Wordpress had been designed to path against its own document root, much like MediaWiki (another great piece of web software).

A while ago, though, I came up with a little hack to make Wordpress do exactly that.

Pharse: a Library for PHP Command-line Option Parsing

I enjoy using PHP for writing command-line applications. PHP's power and flexibility make it ideal, in my opinion, for writing both full-featured applications, as well as for use as a "glue language" for automating various system-administrative tasks. There's one area where PHP has traditionally fallen short in my mind, however - it lacks a good command-line option parser.