PHPackages                             rain/db - 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. rain/db

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

rain/db
=======

DB library wrapper for PDO class

233

Since Apr 28Compare

[ Source](https://github.com/rainphp/RainDB)[ Packagist](https://packagist.org/packages/rain/db)[ RSS](/packages/rain-db/feed)WikiDiscussions Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

\#Rain DB component

Rain DB is a component of the RainFramework 3 that works as wrapper for the PDO class.

Usage
-----

[](#usage)

This class use Static methods to run the queries. Example:

```
use Rain\DB;

// include the autoloader
require "library/Rain/autoload.php";

// configure the class
DB::configure( array("config_dir"=>"config/"); );

// init the connection
DB::init();

// run a query get one row
DB::getRow("SELECT * FROM user LIMIT 1");
```

### Installation

[](#installation)

You can copy this library in your project using composer.

After that you need to configure your connection

### Configure connection

[](#configure-connection)

This class accepts `mysql`, `pgsql`, `sqlite`, `oracle` and `odbc` drivers.

The one that the class uses is defined in the configuration file which by default is `config/db.php`, before using the class you need to edit this file and store your database user, password, etc.

#### Loading and initializate the library.

[](#loading-and-initializate-the-library)

To load the class file you can use composer or a PSR autoloader.

After configurating the class you can initializate the library using the init method

```
use Rain\DB;
require "library/Rain/autload.php";
DB::init();
```

#### Road Map, todo list and wish list, all of it together!

[](#road-map-todo-list-and-wish-list-all-of-it-together)

- select the type of return as array, object, or class (we may want to create a JSON, XML or YAML class with a method \_\_toString )

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/455012?v=4)[rain](/maintainers/RainElemental)[@rainelemental](https://github.com/rainelemental)

---

Top Contributors

[![feulf](https://avatars.githubusercontent.com/u/540035?v=4)](https://github.com/feulf "feulf (44 commits)")[![Faryshta](https://avatars.githubusercontent.com/u/2029247?v=4)](https://github.com/Faryshta "Faryshta (6 commits)")

### Embed Badge

![Health badge](/badges/rain-db/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M117](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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