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

Join the Conversation


  1. You are right on the spot with respect to the difference between Pluf and Django. You can also add that Django is more mature than Pluf.

    The AutoAdmin of Django is available in a way simpler way here:

    What is important to note is that Pluf was modeled based on the pre-magic-removal work of Django.

    Pluf does not try to compete with Django, this is just that I am using both of them and I simply enjoy both of them with their strengths and weaknesses.

    Loïc – Creator of Pluf

  2. Loic, thanks for the feedback and the headsup about the AutoAdmin. I haven’t had a chance to dig my teeth into Pluf but will certainly write up more when I do get the chance.

  3. Another note to mention is that a django project is impossible to deploy without root access, i.e. on a virtual web-hosting for instance. Because one will not be able to install a database lib, e.g. MySQLdb-python, which requires compilation and compilation is usually disabled for unprivileged users. And PHP comes nearly always with mysql support.

  4. I was excited to learn that a php framework has taken on the Django approach. I fiddled around with Pluf and was pleasantly surprised. However I quickly learned that it wasn’t django alone that drew me in. It was the python language. It’s very modern and slick and finally a relief from C language based syntax. Great work folks but it’s not Django. Php guys really need to spend some time learning python to understand what i’m talking about.

Leave a comment

Your email address will not be published.