Learn DooPHP: High performance PHP framework

(Deutsch) DooPHP Einsteiger-Tutorial

Alle, die auf der Suche nach einem Einsteiger-Tutorial für den Start mit DooPHP sind, finden hier eine einfache Anleitung zur Installation und Basis-Konfiguration einer typischen Webanwendung: DooPHP Installation und Konfiguration


Get DooPHP running on Google App Engine

Google App Engine is a PaaS that enables you to build and host web apps on the same systems that power Google applications. App Engine offers fast development and deployment; simple administration, with no need to worry about hardware, patches or backups; and effortless scalability. With the latest Channel API it enables applications to send messages in real time without the use of polling. App engine currently only supports Python and Java and there are no PHP APIs available yet.

However, there’s a workaround to get PHP running on GAE.  With Quercus, you can run PHP on JVM which is supported in GAE infrastructure. Quercus is Caucho Technology’s fast, open-source, 100% Java implementation of the PHP language. Latest version of Quercus supports PHP 5.3.2 thus features like namespace and closure in PHP 5.3 are available. You can use Java classes from PHP(with Quercus) to access various API such as Mail, URL Fetch, XMPP, Task Queues, Google Accounts on App Engine.

Here is an example of DooPHP URI routing demo running on GAE

Now, there are a few steps to get you started with Quercus and GAE.

Step 1: Download and install Resin from http://www.caucho.com/download/

Step 2: Download and install Google App Engine SDK for Java from http://code.google.com/appengine/downloads.html#Google_App_Engine_SDK_for_Java

Step 3: Download this example doophp-gae.zip and upzip it to your preferred location

Step 4: Copy resin.jar


Intro to DooPHP slides (PHP Malaysia meetup 2011)

For those who are looking for the presentation slides for DooPHP used in PHP Malaysia Meetup 2011. You can also click on the link to download the PDF or android apk


Handling sessions without Apache sessions

You are all familiar that Apache sessions are slow and sometimes insecure. In this text I will try to implement way of handling sessions with all Doo::cache mechanisms that are available in DooPhp.
So our sessions will be stored in some of the cache mechanisms. First we will start with writting our session class that will start and end session, we will save it in protected/class folder.
Here is our Session.class

 * Session handler
 * @author Milos Kovacki <kovacki@gmail.com>
 * @copyright Milos Kovacki 2010 <kovacki@gmail.com>
 class Session

 public static $_sessionId = NULL;
 public static $session = array();

 * Start session
 public static function startSession() {
 self::$_sessionId = (isset($_COOKIE['session_id']) ? $_COOKIE['session_id'] : NULL);
 if ((!self::$_sessionId)||(!(self::$session=Doo::cache(Doo::conf()->sessionCacheType)->get('session_'.self::$_sessionId)))) {
 // Create new session
 self::$_sessionId = md5($_SERVER['REMOTE_ADDR'] . time() . rand(0,128));
 self::$session['ip'] = $_SERVER['REMOTE_ADDR'];
 self::$session['created'] = time();
 setcookie('session_id', self::$_sessionId, (time()+3600*24*90), '/');

 * End session
 public static function endSession() {
 $sessionStored = Doo::cache(Doo::conf()->sessionCacheType)->set('session_'.self::$_sessionId, self::$session);


You all noticed variable  Doo::conf()->sessionCacheType so we need to add it in our protected/config/common.conf edit it and add:

$config['sessionCacheType'] = 'apc';

You can choose any type that is supported in Doo::cache, now we will edit our index.php, here is my bootstrap:

//ini_set('display_errors', 1);
include './protected/config/common.conf.php';
include './protected/config/routes.conf.php';
include $config['BASE_PATH'].'Doo.php';