NoSQL Benchmarks NoSQL use cases NoSQL Videos NoSQL Hybrid Solutions NoSQL Presentations Big Data Hadoop MapReduce Pig Hive Flume Oozie Sqoop HDFS ZooKeeper Cascading Cascalog BigTable Cassandra HBase Hypertable Couchbase CouchDB MongoDB OrientDB RavenDB Jackrabbit Terrastore Amazon DynamoDB Redis Riak Project Voldemort Tokyo Cabinet Kyoto Cabinet memcached Amazon SimpleDB Datomic MemcacheDB M/DB GT.M Amazon Dynamo Dynomite Mnesia Yahoo! PNUTS/Sherpa Neo4j InfoGrid Sones GraphDB InfiniteGraph AllegroGraph MarkLogic Clustrix CouchDB Case Studies MongoDB Case Studies NoSQL at Adobe NoSQL at Facebook NoSQL at Twitter



PHP: All content tagged as PHP in NoSQL databases and polyglot persistence

MongoDB: A ToDo App with Ruby and PHP

Sort of ☞ todo.txt, but using MongoDB with ☞ Ruby or ☞ PHP:

Earlier this summer, we kicked off a series on MongoDB where the goal was to write a simple todo application using native MongoDB drivers and three of our favorite scripting languages.

Original title and link: MongoDB: A ToDo App with Ruby and PHP (NoSQL databases © myNoSQL)

Redis: Implementing Auto Complete or How to build Trie on Redis

In the days the news are about instant searches and auto complete, Salvatore Sanfilippo (@antirez) shows how to use Redis sorted sets and corresponding commands (ZRANGE, ZRANK) to implement autocompletion:

The initial code in Ruby:

already got ported to Python:

and ☞ Java and ☞ PHP.

As Ilya Grigorik (@igrigorik) commented, this is building a ☞ Trie with Redis.

Original title and link: Redis: Implementing Auto Complete or How to build Trie on Redis (NoSQL databases © myNoSQL)


CouchDB: Getting Started using PHP

I hope you like this first sight of the CouchDB database. Couch have many other features, but the documents and views are the central part of the system : once those are well understood, the rest is easily understandable. The most difficult part, as said in the introduction, is to forget years of SQL thinking to build web applications.

Definitely not the first CouchDB and PHP guide — see Quick guide to CouchDB and PHP, CouchDB basics for PHP developers, A not-so-quick guide to CouchDB with PHP — and most probably not the last and/or definitive one.

Original title and link for this post: CouchDB: Getting Started using PHP (published on the NoSQL blog: myNoSQL)


MongoDB: 64-bit Integers in PHP

Derick Rethans explains the impact in PHP of one of the 5 MongoDB assumptions: “the machine is 64-bit”:

MongoDB stores documents internally in something called BSON (Binary JSON). BSON has two integer types, a 32-bit signed integer type called INT and a 64-bit signed integer type called LONG. The documentation of the MongoDB PHP driver on types says (or used to say, depending on when you’re reading this) that only the 32-bit signed integer type is supported because “PHP does not support 8 byte integers”. That’s not quite true. PHP’s integer type supports 64-bit on the platforms where the C-data type long is 64 bits. That is generally on every 64-bit platform (where PHP is compiled for 64 bits); except on Windows, where the C-data type long is always only 32 bits.

There’s also a MongoDB JIRA ticket you can watch about this issue ☞ here.

Original title and link for this post: MongoDB: 64-bit Integers in PHP (published on the NoSQL blog: myNoSQL)


PHP, MongoDB and GridFS

The PHP annotations remember me of doing the same in Java pre-1.5. Still useful to separate metadata from your core code:

You can easily setup a Document that is stored using the MongoDB GridFS by using the @File annotation:

Update: there’s ☞ another post showing how to use PHP annotations for different types of embedded documents in MongoDB


RockMongo: Yet Another MongoDB Management and Admin Tool

Just in case you thought there aren’t enough MongoDB tools:

RockMongo, a MongoDB management and admin tool, written in PHP5

As a quick reminder, we have:

RockMongo: PHP, MongoDB Admin


Neo4j and PHP and Probably More

Protocols are extremely important and Neo4j has been opening up to a whole new world with its addition of the REST API. Now people using any programing language can try out this graph database.

Rob Olmost shows an example of using the Neo4j REST API[1] from PHP:

I was trying out Neo4j due to my curiosity of the graph specialization. Although Neo4j is not designed to run stand-alone like a database server there is a sub-project that adds a REST API to allow non-Java applications to make use of Neo4j. Neo4j is pretty simple, you basically have nodes, relationships, and properties on both. That’s about it.

First time I’ve heard of Neo4j, my first question was: how will I be able to define custom traversals? One part that I wasn’t aware of in the Neo4j REST is the embedded JavaScript engine — they chose Rhino for its easy integration with Java — allowing users to define node traversals using javascript. Problem solved!

As a side note (and I haven’t checked the code it), I think that integrating any language that runs on top of the Java VM would be possible, so imagine having your traversals in your preferred language like Groovy, Python, Ruby, or even Clojure. Pretty cool, isn’t it?

  1. You can read more about using Neo4j REST API ☞ here  ()


A MongoDB-based PHP Session Handler

Source code for a MongoDB-based PHP session handler. Make sure you are reading the warnings (no concurrency support, durability, etc.):

This class was built as a drop-in for easily switching to handling sessions using Mongo. It’s a great replacement to memcache(d) for VPS servers where you risk memory being reshuffled in the pool and taking performance hits.


Analogue: CouchDB-based IRC+IM+Commenting

anologue is like comments, meets im, meets irc, meets your favorite paste app, meets instant coffee.

with anologue you can quickly and easily engage in an anonymous (or not) linear dialogue with any number of people (within reason).

your “chat room” is created by the time this link loads. invite whoever you want by giving them your unique link, and chat away.

Built using lithium framework[1] and jQuery on top of CouchDB. Source code available ☞ here

  1. ☞ lithium is a PHP framework  ()


Tutorial: Getting Started with MongoDB and PHP

Not that we are short on MongoDB and PHP tutorials, but PHP programmers seem to have fun with MongoDB:

In this article, I’ll introduce you to MongoDB, one of the new generation of schema-less database systems that is quickly gaining the attention of open source developers. Over the next few pages, I’ll guide you through the process of getting started with MongoDB, showing you how to install it, set up a data store, connect to it and read and write data using PHP. Let’s get started!


As these examples illustrate, MongoDB provides a solid, feature-rich implementation of a schema-less database system. Availability for different platforms, easy integration with PHP and other languages, and extensive documentation (plus a very cool interactive online shell for experimentation) make it ideal for developers looking for a modern, document-oriented database. Try it out sometime, and see what you think!


A Not-So-Quick Guide to CouchDB with PHP

Till Klampaeckel has published a ☞ 3 part introduction to CouchDB for PHP developers.

This is part three of a beginner series for people with a MySQL/PHP background. Apologies for the delay, this blog entry has been in draft since the 13th December of last year (2009).

While the guide is pretty good, I’m not sure why MySQL or relational databases are mentioned in the title as the references/parallels are quite rare. If you are looking for more resources on CouchDB and PHP you should also try CouchDB basics for PHP developers and Quick Guide to CouchDB and PHP.

MongoDB and PHP Resources

Just a couple of articles for the PHP programmers interested in MongoDB. In the past we’ve also published a quick guide to Zend and MongoDB.

☞ MongoDB Tutorial

MongoDB strikes a balance between the familiarity and ease of use of MySQL, and the freeness and performance offered by document storage databases. The database has no set schema so you can add, remove and modify the structure of your documents without having to issue an UPDATE statement.


  • installation on Windows
  • a MongoDB wrapper
  • using the MongoDB wrapper for basic CRUD operations

☞ document databases (MongoDB + PHP tutorial)

With document-oriented databases this is not the case. You just create a database and start developing. Every time you need to save some data, you just create a document, add the fields you need (for a shopping card you’d probably save a user_id, date, price, all the items, …) and save it to the database.


  • installation on Mac OS X
  • basic CRUD operations

☞ Developing scalable PHP applications using MongoDB - PHP Classes

Nowadays there is a new kind of databases that is getting very popular, specially for Web development, including the PHP world, which are the NoSQL databases.

This article focus specifically on MongoDB, despite there are several other NoSQL database implementations.

Note: the page looks really bad so you’ll probably get a much better experience if using one of the following cleaned up versions: ☞ instapaper mobilizer or ☞ google mobilizer


  • basic intro to MongoDB
  • basic CRUD operations
  • an intro on MongoDB indexes
  • storing files in MongoDB
  • short Map-Reduce example

☞ Removing files from MongoDB with GridFS

A tip on how to check file removal worked as expected:

Yes, you already figured out it’s as simple as $grid->remove(). Here is something to keep in mind. MongoGridFS::remove won’t present you with a message if it failed. To ensure that a file was successfully removed use MongoDB::lastError().

☞ MongoDB + CodeIgniter 101 (Part 1)

So I’ve decided that I want to properly document my MongoDB exploration and I may as well help others to learn with me. […] What I’m going to do here in part 1 is install MongoDB, install the PECL PHP extension and just play around a bit.


  • installation on Ubuntu
  • installation of MongoDB PECL extension
  • basic blog sample application

☞ Using MongoDB with CakePHP

I originally intended to sit down and start writing a Mongo datasource only to find that Yasushi Ichikaway had totally beat me to it, and written a great datasource. So instead, I’ll write about how you can get up and running with MongoDB.

A very basic example.

☞ Loading Drupal Nodes into MongoDB with Drush

To do some prototyping, I wanted to load all 32k of our Drupal nodes into MongoDB. At first, the thought of doing this seemed daunting. Then I realized that with Drush I could use a very simple script to perform an entire migration. The result: With a 14 line PHP script, I transferred all of the nodes (CCK, taxonomy, and all) without a glitch.

I bet there are more such resources about MongoDB and PHP, but I hope these are will be a good start for every PHP programmer interested in MongoDB.

Disclaimer: I am not very familiar with the PHP development so the above articles were picked based on Twitter reactions.