PHP Routing

If you’ve ever written web applications in Python using Pylons or TurboGears (>=1.1), you’re probably familiar with an incredibly handy tool known as Routes. It’s modeled after the Ruby on Rails routes system and does quite a marvelous job at mapping friendly, SEO URLs to useful code. If you’re not aware of it, you really should check it out.

However, I was curious to see if it were possible to create a Routes-inspired PHP library that would perform essentially the same task. I’m sure there’s an already-written PHP routes system, and I’ve allowed myself to fall into the not invented here trap. But, that’s part of the fun in coding: If you don’t like what someone else wrote or you want to give it a hand yourself, no one is stopping you. It’s great.

Thus, I’ve written Routing, the PHP routes system. It’s similar in syntax and intent to Python Routes with the exception that it’s PHPized (in other words: bastardized). If you read the sources, you might be able to see a little Python influence here and there (along with my frustrations toward PHP as a language vented in silence). I wouldn’t recommend it as anything short of entertainment as yet; I haven’t cleaned up the sources, and I expect they’re going to be really messy for a little while. The route search mechanism is awful, and I plan on refactoring it in a future revision. For now, the system works, and that’s good enough. (That’s my INTJ side talking.)

So, if you’re curious enough to take a look, head over to the Routing Trac page. I have some downloads posted there in a variety of formats (.zip, .tar.gz, and .tar.bz2). There’s no API documentation yet. I’m going to add it soon. Since Routing was born on Wednesday, August 5th, 2009 it’s quite young. However, I have some preliminary unit tests written (also incomplete) that you can read to get a general understanding of how Routing works. If you’re more interested in the principle behind Routing, you might want to read the documentation for Python Routes. Routes and Routing work roughly the same with the exception that Routing, unlike Python Routes, is extraordinarily buggy. I hope I can evolve this into something of an acceptable sibling to Routes but that will take time and a whole lot of effort. I have a few additional ideas, too.

1 comment.
***

Announcing Chatly

Chatly

About a week ago, I finished the first release-quality beta version of an application I have called Chatly. It isn’t a whole lot right now as not all features have been fully implemented, but it includes both the client (a stand alone application that uses PyQt for GUI management) and a server. Both client and server utilize Twisted under the hood for robust network communications. The project itself has been written entirely in Python. I also have a brief write-up on this site about Chatly, although you might be more interested in looking at Chatly’s Trac page that includes browseable sources!

I currently have only a Windows release available for download, although you may also grab a source-only version linked from here. The distutils/setuptools setup.py doesn’t quite work yet, but I do intend to package a functioning Python egg in the future. For *nix platforms without Python (or the necessary libraries), I’ll also be releasing a “freeze” distribution. For now, you’ll need PyQt 4.4.3 or later, Python 2.5 or later, Twisted 8.2 or later, and some patience. I’d like to build an OS X package in the future but haven’t any access to Apple hardware for now. If you can help, just drop a comment here as I may have future projects that will be Qt-based.

Chatly is released under a two-clause BSD license (no advertising clause).

No comments.
***

Python Gotchas: Class Attributes versus Instance Members

Links of the Week will be delayed until tomorrow or Friday.

Today, I’d like to share with you a real treat. It happened well into the evening last night when my coherent thought processes were lost in a semi-drunken stupor induced by lack of sleep (I don’t drink, but I do have slight insomnia sometimes). What was most ironic is that in the five or so years of writing in Python (off and on) I have never encountered this particular problem.

Click that fancy link (below) to read more. This is a fairly lengthy article, so make sure you have some free time!

I want to read more…
No comments.
***
Page 1 of 41234Next »