10gen Launches Partner Program to Accelerate Demand for MongoDB


MongoDB PHP Driver 1.3.7


MongoDB For Beginners: Setting up MongoDB For PHP

The MongoDB server is built to already work with your current web server. The problem is that you’ll need to install drivers for your preferred backend language – PHP, Ruby, Node.js, Perl, whatever. I won’t go into the process of installing WAMP/MAMP because this is a bit off topic from Mongo.

Full Story:



PHP Libraries, Frameworks and Tools

The PHP community has created a huge number of libraries to make working with MongoDB easier and integrate it with existing frameworks.

Libraries and Frameworks



ODM (Object Document Mapper) is an experimental Doctrine MongoDB object mapper. The DoctrineODMMongo namespace is an experimental project for a PHP 5.3 MongoDB Object Mapper. It allows you to easily write PHP 5 classes and map them to collections in MongoDB. You just work with your objects like normal and Doctrine will transparently persist them to MongoDB.

This project implements the same “style” of the Doctrine 2 ORM project interface so it will look very familiar to you and it has lots of the same features and implementations.


  • MongoDB Integration: Views (query builder) backend, a watchdog implementation (logging), and field storage.

Fat-Free Framework

  • Fat-Free is a powerful yet lightweight PHP 5.3+ Web development framework designed to help you build dynamic and robust applications fast.

Kohana Framework


  • Lithium supports MongoDB out-of-the-box.

Symfony 2


An extensive MVC 2 based PHP framework which supports MongoDB directly with only PHPMongo extension.


Thundergrid is a GridFS framework for PHP. Thundergrid is a simple framework written in PHP that allows you to rapidly store files in your MongoDB database using the GridFS specification.

Thundergrid gives you the ability to control exactly how you use GridFS in your scripts. It allows you to list, filter, and display objects within GridFS quickly and rapidly.


../../_images/php-libraries-frameworks-and-tools-vork.pngVork, the high-performance enterprise framework for PHP, natively supports MongoDB as either a primary datasource or used in conjunction with an RDBMS. Designed for scalability & Green-IT, Vork serves more traffic with fewer servers and can be configured to operate without any disk-IO.

Vork provides a full MVC stack that outputs semantically-correct XHTML 1.1, complies with Section 508 Accessibility guidelines & Zend-Framework coding-standards, has SEO-friendly URLs, employs CSS-reset for cross-browser display consistency and is written in well-documented object-oriented E_STRICT PHP5 code.

An extensive set of tools are built into Vork for ecommerce (cc-processing, SSL, PayPal, AdSense, shipment tracking, QR-codes), Google Maps, translation & internationalization, Wiki, Amazon Web Services, Social-Networking (Twitter, Meetup, ShareThis, YouTube, Flickr) and much more.


  • YiiMongoDbSuite is an ActiveRecord-like support for MongoDB in Yii. It originally started as a fork of MongoRecord extension to fix some major bugs and to add full featured suite for MongoDB developers.

Zend Framework

Stand-Alone Tools

Autocomplete for IDEs

  • PeclMongoPhpDoc gives IDEs information about the Pecl extension to help with autocomplete and docs.



  • Comfi is a MongoDB PHP ORM (part of Homebase Framework)

MapReduce API


  • Mongofilesystem is a filesystem based on MongoDB GridFS. It will help you use MongoDB GridFS like a typical filesystem, using the familiar PHP commands.


  • Mandango is a simple, powerful, ultrafast Object Document Mapper (ODM) for PHP and MongoDB.

MongoDB Pagination

  • PHP MongoDB Pagination is the pagination plugin for MongoDB released under MIT License. It is simple to install and use. It has been developed under TechMVC 3.0.4 but is compatible with any 3rd party framework (e.g. Zend (tested)).


  • MongoDb PHP ODM is a simple object wrapper for the MongoDB PHP driver classes which makes using MongoDB in your PHP application more like ORM, but without the suck. It is designed for use with Kohana 3 but will also integrate easily with any PHP application with almost no additional effort.


A library on top of the PHP driver that allows you to make more natural queries ($query->query('a == 13 AND b >= 8 && c % 3 == 4');), abstracts away annoying $-syntax, and provides getters and setters.


MongoQueue is a PHP queue that allows for moving tasks and jobs into an asynchronous process for completion in the background. The queue is managed by MongoDB.

MongoQueue is an extraction from online classifieds site Oodle. Oodle uses MongoQueue to background common tasks in order to keep page response times low.


MongoRecord is a PHP MongoDB ORM layer built on top of the PHP MongoDB PECL extension.

MongoRecord is an extraction from online classifieds site Oodle. Oodle’s requirements for a manageable, easy to understand interface for dealing with the super-scalable MongoDB datastore was the primary reason for MongoRecord. It was developed to use with PHP applications looking to add MongoDB’s scaling capabilities while dealing with a nice abstraction layer.


  • Morph at GitHub is a high-level PHP library for MongoDB. Morph comprises a suite of objects and object primitives that are designed to make working with MongoDB in PHP a breeze.



  • TURBOPY is a cloud-based content management framework and IDE using new editing concepts working with MongoDB.


MongoDB PHP Tutorial


Sales Lead Tracking with PHP and MongoDB via MongoLab REST API


Building First App with MongoDB


MongoDB: 5 Things Every PHP Developer Should Know About MongoDB

Matt Butcher

  • MongoDB is a stand-alone server
  • It is document based, not table-based
  • It is schemaless
  • You don’t need to learn another query language
  • It has great PHP support

Read on to learn a little about each of these.

1. MongoDB is a stand-alone server

Like MySQL or other PostgreSQL, MongoDB listens on a port for incomming connections. It provides tools for querying, creating, updating, and deleting. In theory, you work with it in much the same way that you work with MySQL or PostgreSQL: Connect, perform operations, and close the connection.

2. Goodbye rows and tables, hello documents and collections

Instead of storing data as rows in tables, MongoDB stores entire documents. If a have an piece of ‘article’ data with a title, multiple authors, a body, and tags, the entry is basically going to look like this:

<?php array(   ‘title’ => ‘Hello World’,   ‘authors’ => array(‘John’, ‘Sally’, ‘Jim’),   ‘body’ => ‘Hello world’,   ‘tags’ => array(‘tag1’, ‘tag2’, ‘tag3’) ); ?>

The key thing to notice about the example above is that this one record — this document — is actually stored like a document, and supports things like multiple values for the same field. There is no need to normalize the data into separate tables because, well, there are no tables.

Now, instead of storing documents in a table, they are stored in a collection, which you might think of as something akin to a big list of documents.

3. MongoDB is schemaless

There is no schema language for MongoDB. If you want to create a new document type, you needn’t do anything to tell the database about it beyond simply pushing the new data into the database.

In number2, I mocked up a document. Now if I wanted to define an article type with those fields on it, all I need to do is write the object into the database. What if I decide later to add, say, a date? I just pull the article out of the database, add the date field, and save it.

What about data types? The short answer is that MongoDB uses a type coercion system similar to JavaScript or PHP. That is, the database is effectively weakly typed.

There are a few caveats to that (large chunks of data may need some explicit handling), but for the most part, you can write your MongoDB code like your PHP code.

4. You don’t need to learn another query language!

Remember all of those database abstraction layers you’ve written? Remember all of those ORM layers you’ve worked with? Well you can toss them out. You don’t need them with Mongo.

MongoDB (when using it’s PHP driver) doesn’t have much of a query language. In most cases, you simply give it an array specifying information you want, and it returns you an array of documents.

If you want to run some really sophisticated queries (like Map-Reduce operations), you can pass JavaScript functions into MongoDB, and its internal JavaScript engine can execute the script.

5. PHP and MongoDB are a match made in heaven

PHP already has great MongoDB support. The Mongo driver is available as a PECL extension to PHP, which means that installing it is as easy as running pecl install mongo. (Earlier I wrote a short article detailing the installation process)

From there, you can get started working with Mongo’s API. Complexity-wise, it ranks alongside PDO. It’s not dead-simple, but there should be nothing foreign about it for anyone who has done database development before.

The API documentation (linked above) includes a tutorial and lots of samples, so you should be able to ramp up in a very short period of time. And here’s what you will notice as you go:

  • MongoDB is blazingly fast
  • Development time is faster, too, since there are no schemas to manage, and very little (if any) data mapping.
  • Learning curves are short, because there is no new query language to learn.
  • Code is trimmer. After all, you don’t need another ORM, and wrappers are likely to be thin.
  • Your code is future-proof. It’s trivially easy to add more fields — even complex fields — to your objects. So as requirements change, you can adapt code quickly.

It took me only one session of MongoDB programming to realize its game-changing potential. That’s what leads me to claim that the new generation of document databases are going to leave SQL-based RDBM systems in the dust — or, more likely, leave them to do what they do well: store data that actually belongs in rows and tables.




Welcome to MongoDB Studio

MongoDB community based Website offering resources to help developers and DBA’s learn MongoDB