DataMapper ORM


Installation Instructions

Short Version

Unzip and copy everything within application into your CodeIgniter installation's application folder, add the bootstrap to the index.php file, edit the config, and go map some data!

Long Version

DataMapper is installed in seven steps, with two optional steps:

  1. Unzip the package.
  2. Open the application/config/datamapper.php file with a text editor and set your preferred DataMapper settings.
  3. Upload the application/config/datamapper.php file to your CodeIgniter application/config folder.
  4. Upload the application/libraries/datamapper.php file to your CodeIgniter application/libraries folder.
  5. Upload the application/third_party/datamapper folder to your CodeIgniter application/third_party folder.
  6. Upload the application/language folder to your CodeIgniter application/language folder.
  7. Open your CodeIgniter application/config/autoload.php file with a text editor and add the database and datamapper libraries to the autoload libraries array.
    $autoload['libraries'] = array('database', 'datamapper');
    Also, make sure you clear the models array, because DataMapper automatically loads these.
    $autoload['models'] = array();
    For further information on auto-loading, read Auto-loading Resources.
  8. Open your CodeIgniter application/config/database.php file with a text editor and set your database settings, ensuring you set the dbprefix to an empty string.
    $db['default']['dbprefix'] = "";
    For information on using table prefixes with DataMapper, read Setting up Table Prefixes.
  9. Open your CodeIgniter /index.php file with a text editor and add the DataMapper bootstrap, directly BEFORE the Codeigniter bootstrap.
    /* --------------------------------------------------------------------
     * LOAD THE DATAMAPPER BOOTSTRAP FILE
     * --------------------------------------------------------------------
     */
    require_once APPPATH.'third_party/datamapper/bootstrap.php';
  10. Optionally, upload the application/helpers/inflector_helper.php file to your CodeIgniter application/helpers folder.
  11. Optionally, upload the application/datamapper directory to your CodeIgniter application folder, to enable the use of extensions. Highly Recommended! This doesn't have any performance penalty if you do not load the extensions.

    Some extensions may require additional views, libraries, helpers, or other items to function correctly. Please check the extensions you plan on using.

That's it!


If you're new to DataMapper, please read the Getting Started section of the User Guide to begin learning how to use DataMapper. Enjoy!