This is my pet project, it originated and had two other children ( and
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

#MediaLab Build Status


This source code has its origins on the web service Plifk (the online version is pretty outdated however). This code is no way perfetct. There are several bad design choices and lack of methodology in developing it. Work is in progress to make it better.

Influence: Flickr, Twitter,, and Multiply (when it was more like Facebook) and more.

Two other web services were based on forks of this code base:

  • is a minimalist Twitter-based blogging system
  • is a flee market for the Twitter social network, with a GUI similar to that of


This was only tested on Mac OS X and Linux environments. It might also work on Windows (but not the install script). Note that most of the system can work with a simpler setup, but don't assume this to be true.

PHP and Servers

Please note that the default memcached is insecure by design because it's freely accessible from everywhere. You must restrict access to it yourself.


PHP Libraries

For performance you want to strip the require_once's from the Zend framework code, see How can I optimize my include_path?

Client-side dependencies

Bootstrap, from Twitter (version 1.4, migration to 2.0 soon) jQuery jQuery.fn.autoResize Tablesorter YUI 3 (version 3.1)



On your CLI (command-line interface) run bin/install:

cd bin

For development you will want to respond with "development" on the question about the application environment

This will take care of setting application paths, downloading and setting up the dependencies. But you will still need to do some work. It will write a *application/configs/Environment.php.dist similar to application/configs/Environment.php, with the choosen timezone and directory and file paths. If you are using Windows you will need to generate this file by your own (as well, solve dependencies, etc the way the installer does so you will want to take a look at its source code).

If a extension is missing you will know it. You can get most of them with PECL or apt-get on a Debian-based system such as Ubuntu.

For example, if mongo is missing you can use:

sudo pecl channel-update
sudo pecl install mongo
echo >> /etc/php.ini

Create the databases structures

MySQL tables have to be built. The DB scheme is at application/configs/db.sql

The following CouchDB databases have to be created: web_access_log, and actions_log.

Points of entry

There are three modules: default, services and api. And also a simple redirector system.

The services module

It's CLI based, not web based. Point of entry: bin/services

Web based points of entry

  • public/index.php for the default
  • public-api/index.php for the API
  • public-redirector/index.php for the redirector system

You have to set up your web server configurations with regard to these. Use virtual hosts.

Rewrite rules

If you use Apache as your web server, the following rewrite rules might be used so the system receives the requests sent to it:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ – [NC,L]
RewriteRule ^.*$ index.php [NC,L]

For performance and to avoid the trouble with dealing with .htaccess I recommend not to use it (and disable it), instead put this on a Apache configuration file. Some text that might help you make a wise choice: Remove index.php From URLs

Note /index.php is hard-coded to return a 404 Not Found to make sure you do the proper thing and to avoid duplicates.

A word on static assets

You have static assets (on the statics directory) such as images, JavaScripts and CSS which your users need to access. For production it might be wise to use a CDN service (such as S3 + CloudFront) for this.

For development (or in production if you don't want to use a CDN) you can set up even another virtual host for this (you don't need to point to any index.php in this case, even because it just doesn't exists). In case you are using this in production you may want to configure your web server not to list the directories contents.

Scheduled tasks

Some operations might be expensive. For example: if a user removes his account it is not smart to start a batch delete operation of all his files right away (and let him waiting for it, for instance). A way to solve this and other similar issues is to make use of a scheduled task to run from time to time and do this heavy work.

Right now there are only a few of crontab jobs as you can see on the example below:

20 * * * * /path/to/application/bin/service --action cleanfiles --controller garbage >> /dev/null 2>&1
20 3 */2 * * /path/to/application/bin/service --action cleanoldnewusers --controller garbage >> /dev/null 2>&1
30 4 */3 * * /path/to/application/bin/service --action cleanoldrecover --controller garbage >> /dev/null 2>&1
40 5 */4 * * /path/to/application/bin/service --action cleanoldemailchange --controller garbage >> /dev/null 2>&1

Push, open bugs, etc.

Feel free to push code to this repository. Anything you want, go to the issue tracker.


This software is provided "as is", without warranty. The New BSD License and the MIT License are the licenses (case you need something legal).


Henrique Vicente de Oliveira Pinto (email, Twitter, Flickr, Linkedin).