In this recent tutorial from the NETTUTS.com website they show how you can create your own URL shortening service (think tinyurl or tr.im) with the help of the Phurl PHP application.
URL shortening services are a must if microblogging services like Twitter are to work. In 140 characters, you don't want the URL you're linking to eating up 100 of them. Or worse, it might not even fit. Enter TinyURL, and a bunch of other services that give you a shorter custom URL pointing to the target site. But why not roll your own, using Phurl? Let's do it!
The tutorial walks you through the installation (quick and easy thanks to a graphical installer) and some usage examples (with screenshots). A few other things - like branding and allowing multiple URLs - are suggested as future enhancements.