Web.php

Web.py is a really nice lightweight web framework written in Python. It’s not trying to be Rails or Django, it’s trying to be as simple as possible. Web.php is my homage to Web.py. I’ve unashamedly copied the ideas and build a very simple web framework in PHP. It’s not a complete port, nor does it do everything in the same way.

The code example from the project home page was what originally piqued my interest:

import web urls = ( '/(.*)', 'hello' ) class hello: def GET(self, name): i = web.input(times=1) if not name: name = 'world' for c in xrange(int(i.times)): print 'Hello,', name+'!' if __name__ == "__main__": web.run(urls, globals())

My PHP versions goes something like this, I’m sure you can see the similarities:

<?php require('webphp/web.php'); $urls = array( '/' => 'hello', ); class hello { function GET($path) { echo 'hello world'; } } web::run($urls); ?>

I’ve used it so far on a couple of projects, but it’s never been properly tested as such nor do I have lots of time to develop it. It’s purposely feature and code light (the core file is only 80 odd lines of code, includig comments).

Download Zip