Installing Pomm 1.x

For each version's minimum requirements, please check the download page.

The easy way: composer

If, like us, you love composer, you can have a look at Pomm's packagist page. Basically, installing Pomm in an existing project will be as simple as adding the following line to your composer.json file in the require section:

"pomm/pomm":"1.2.*"

If you are starting a stand alone project from scratch, here is the complete composer.json file:

1 {
2     "require": {
3         "pomm/pomm": "1.2.*"
4     }
5 }

Now, just invoke composer:

$ composer.phar install

and it will download the latest 1.2 version of Pomm and set a class autoloader for your project. The last thing you have to do is to include composer's autoload file and you can use Pomm right awyay

1 <?php
2 
3 require __DIR__."/vendor/autoload.php";
4 
5 $database = new \Pomm\Connection\Database(array(
6     'dsn' => 'pgsql://user:password@host/db_name',
7     'name' => 'my_project'
8 ));

Manual installation

If for some reasons you cannot use composer, you have to install Pomm manually. Just download it and save it in a directory. If no autoload mechanism is available, you will have to provide one: Pomm needs an autoloading system. Here is one:

 1 spl_autoload_register(function ($class) {
 2     if (0 === strpos($class, 'Pomm\\')) {
 3         $class = str_replace('\\', '/', $class);
 4         require sprintf("%s/%s.php", __DIR__, $class);
 5 }