PHPackages                             entraigas/slimdb - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. entraigas/slimdb

ActiveLibrary[Database &amp; ORM](/categories/database)

entraigas/slimdb
================

Slim Database, a wrapper around pdo

v1.2.3(11y ago)1391MITPHPPHP &gt;=5.3.0

Since May 9Pushed 11y ago2 watchersCompare

[ Source](https://github.com/entraigas/SlimDb)[ Packagist](https://packagist.org/packages/entraigas/slimdb)[ Docs](http://github.com/entraigas/SlimDb)[ RSS](/packages/entraigas-slimdb/feed)WikiDiscussions master Synced today

READMEChangelog (9)DependenciesVersions (12)Used By (0)

SlimDb
======

[](#slimdb)

Small db layer around the PDO and PDO statement.

The package goal used to be small and handy, with the basic, commonly used db functions (like select, update, insert and delete). Now it's more ambitious, and it's no so small and basic. Note: there's only support for mysql and sqlite.

Installing the package
======================

[](#installing-the-package)

You can download the package directly from [GitHub](https://github.com/entraigas/SlimDb)Or install it using `composer.json` file

```
{
	"require": {
		"entraigas/slimdb": "v1.2.1"
	}
}

```

Db Setup
========

[](#db-setup)

The configuration it's done using arrays. In this example, there are two db settings:

- the first has 'portal' as connection name, and it's a mysql db.
- the second has 'admin' as connection name, and it's a sqlite db.

Finally, there is a 'default' connection name configured with the 'portal' value.

```
//database configuration array
$portal => array(
	'driver' => 'mysql',
	'getPdo' => function(){
			//validate PDO extensions
			if (!defined('\PDO::ATTR_DRIVER_NAME')) return false; //PDO is not available
			if (!extension_loaded('pdo_mysql')) return false; //pdo_mysql extension not loaded
			//make connection
			$pdo = new \PDO("mysql:host=127.0.0.1;port=3306;dbname=testdb", 'user', 'password');
			//default connection settings
			$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
			$pdo->query("SET NAMES 'utf8'");
			//done, return pdo object
			return $pdo;
		}
);
$admin => array(
	'driver' => 'sqlite',
	'getPdo' => function(){
			//validate PDO extensions
			if (!defined('\PDO::ATTR_DRIVER_NAME')) return false; //PDO is not available
			if (!extension_loaded('pdo_sqlite')) return false; //pdo_sqlite extension not loaded
			//make connection
			$pdo = new \PDO("sqlite:/path/to/database.db");
			//default connection settings
			$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
			//done, return pdo object
			return $pdo;
		}
);

//initialize SlimDb
\SlimDb\SlimDb::configure('portal', $portal);
\SlimDb\SlimDb::configure('admin', $admin);

//set the default connection
\SlimDb\SlimDb::setDefaultConnection('portal');

```

There are many classes bundled with the package. Depending on what you are trying to do, you should use one over the other. Here is a list:

- [Running raw queries: SlimDb or Database classes](https://github.com/entraigas/SlimDb/blob/master/Docs/SlimDb.class.md)
- [Fetching data: ResultSet class](https://github.com/entraigas/SlimDb/blob/master/Docs/ResultSet.class.md)
- [Working with Tables](https://github.com/entraigas/SlimDb/blob/master/Docs/Table.class.md)
- [Working with Orm](https://github.com/entraigas/SlimDb/blob/master/Docs/Orm.class.md)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~37 days

Recently: every ~81 days

Total

10

Last Release

4048d ago

Major Versions

v0.1 → v1.0.22014-05-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/ee69112a87f639975949f63fc439a46c9d0e1ede5c077d45a5f20fe415afcc07?d=identicon)[entraigas](/maintainers/entraigas)

---

Top Contributors

[![entraigas](https://avatars.githubusercontent.com/u/1842149?v=4)](https://github.com/entraigas "entraigas (45 commits)")

---

Tags

phpdatabasepdo

### Embed Badge

![Health badge](/badges/entraigas-slimdb/health.svg)

```
[![Health](https://phpackages.com/badges/entraigas-slimdb/health.svg)](https://phpackages.com/packages/entraigas-slimdb)
```

###  Alternatives

[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.5M69](/packages/ifsnop-mysqldump-php)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k22.9k](/packages/clouddueling-mysqldump-php)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1814.6k11](/packages/popphp-pop-db)[riverside/php-orm

PHP ORM micro-library and query builder

111.2k](/packages/riverside-php-orm)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
