Manual Installation

No Composer? No problem. PDOdb is a single file – just download and include it.

When to use this

Manual installation makes sense when:

  • Composer is not available on your hosting environment
  • You are working on a legacy project without autoloading
  • You prefer to manage dependencies yourself

Download

Download the latest release from GitHub and grab the PDOdb.php file:

Download latest release from GitHub

You only need the single file PDOdb.php – nothing else.

Place the file

Put PDOdb.php somewhere in your project. A common structure looks like this:

your-project/
├── index.php
└── libs/
    └── PDOdb.php

The exact location does not matter – just make sure the path in your require_once matches.

Include the file

Add the require_once and the use statement at the top of your script:

require_once __DIR__ . '/libs/PDOdb.php';

use decMuc\PDOdb\PDOdb;
Even without Composer, the class keeps its decMuc\PDOdb namespace. The use statement is required – or reference the class directly as new \decMuc\PDOdb\PDOdb(...).

Your first query

Create a connection and run a query:

$db = new PDOdb([
    'host'     => 'localhost',
    'username' => 'root',
    'password' => 'secret',
    'db'       => 'my_database',
    'charset'  => 'utf8mb4',
]);

// Step by step
$db->whereInt('active', 1);
$users = $db->get('users');

// Fluent
$users = $db->whereInt('active', 1)->get('users');

// → SELECT * FROM users WHERE active = 1

See also