A CodeIgniter active record library for MongoDB

This evening I started work on an active record inspired library for interacting with MongoDB via a CodeIgniter library.

So far I’ve got searching and inserting working. Updating and deleting are going to take more time because they’re a bit trickier.

What this means is you can easily work with a database collection like so:

$this->mongo_db->where_gte('age', 18)->where(array('country' => 'UK', 'can_drink' => TRUE))->get('people');


$this->mongo_db->get_where('posts', array('title' => 'Hello, World!');

Or just:


I’ve created a repository on Bitbucket located at http://bitbucket.org/alexbilbie/codeigniter-mongo-library. If you have a look at the README file there is an overview of what is there so far and also what needs doing (and some maybes!).

Hope people find it useful.

Very fast file caching library for CodeIgniter

I’ve written a file caching library for CodeIgniter. It’s blazing fast, can cache anything, for any length of time, and supports cache tagging which means you can delete whole groups of cache files at once. It’s completely self cleaning and also has a method that can be called in a cron job to keep the file-system tidy.

It is intended to be used alongside CodeIgniter’s own caching library.

The code is here http://bitbucket.org/alexbilbie/codeigniter-file-caching-library


Add something to the cache (returns TRUE if successful)
$this->cache->set( (string)$id, (mixed)$data, (array)$tags, (int)$lifetime );

Get something from the cache (returns FALSE if fail)
$this->cache->get( (string)$id );

Delete an item
$this->cache->delete( (string)$id );

Delete an item by tag (accepts either one tag or an array of tags)
$this->cache->delete_by_tag( (string|array)$tags );

Delete all (this will only delete cache files created by this library, not CodeIgniter’s own caches)

Cleanup (intended for use in a scheduled/cron job)

I hope people find it useful!