PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Gonzalo Ayuso's Blog: Database connection pooling with PHP and React (node.php)

Note: This article was originally published at PHPDeveloper on 22 May 2012.
PHPDeveloper

In this latest post Gonzalo Ayuso his recent experiences with React (Node.js in PHP) and an example of how he worked up a script to pool database connections.

Last saturday I meet a new hype: "React" also known as "node.php". Basically it's the same idea than node.js but built with PHP instead of javascript. [...] Basically I want to create a database connection pooling. It's one of the things that I miss in PHP. I wrote a post here some time ago with this idea with one exotic experiment building one connection pooling using gearman. Today the idea is the same but now with React.

He includes the sample script, also including the line to add to your composer.json file to install React and the SQL to create the sample tables. The script makes a PDO connection and assigns it to the pool, an instance of his "CPool" class. If you want to try it out, you can find the code over on github.