Pluf – A PHP5 Port of Django

Pluf is a PHP Framework developed as a port of Django to PHP. It claims to be simple, elegant and easy for people used to Django but in PHP5 so easy to deploy all over the world.

After reading the documentation, the file layout and concepts are all quite similar to django, though a downside is that we lose much of the beauty of the Python language and it doesn’t seem to have the Admin interface that makes django so delightful to work with.

Here is a sample of a helloworld, which would exist in a file called “Hello/Views.php”

< ?php
class Hello_Views
    public function hello($request, $match)
        return new Pluf_HTTP_Response('Hello World!');

as you can see, it is reasonably similar to (though more verbose than) Django’s equivalent “/hello/” which would look like this:

from django.http import HttpResponse
def index(request): 
    return HttpResponse("Hello world")

Check out the full helloworld tutorial of Pluf


Pluf has an ORM that applies similar concepts and ideas as Django’s ORM, though as with the helloworld, it is slightly more verbose. The rest of the framework follows the same patterns, urls.php has a more verbose PHP regex patterns than django’s


Pluf runs it’s own caching system as well as being able to utilise APC and Memcached

Django vs Pluf

So what exactly does Pluf offer in ways of advantages over Django and why would you choose to use it instead? The obvious reasons are if you are well setup as a PHP developer. You work with tools and ide’s setup specifically for PHP, you have hosting infrastructure setup for PHP and you work with developers who are well versed in PHP. The other advantage of Pluf is that it comes with a migration framework out of the box, whereas django doesn’t and you need to use one of the available database schema migration, the most promising currently looks like South

Of course, Django deployment is becoming much simpler recently by leveraging the tutorials and tools like virtualenv, pip and most recently modrails has begun supporting python wsgi services. I recently performed some benchmarks with modrails vs fastcgi against a django blogging application called byteflow and modrails provided approx 1.8x speedup. More to come on that later.

Technorati Tags: , , , , ,

Published by salubrium

I am a Systems Administrator based in Sydney, Australia with some hugely varied interests: Topics covered are Virtualization, Web Hosting, Remote Desktop, Security and Backups, PHP, Python, MVC Frameworks, SEO

Leave a comment

Your email address will not be published. Required fields are marked *