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

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

php-db/phpdb
============

Database abstraction layer, SQL abstraction, result set abstraction, and RowDataGateway and TableDataGateway implementations

0.5.0(5mo ago)1979.4k↑127.5%8[23 issues](https://github.com/php-db/phpdb/issues)[6 PRs](https://github.com/php-db/phpdb/pulls)10BSD-3-ClausePHPPHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Aug 6Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/php-db/phpdb)[ Packagist](https://packagist.org/packages/php-db/phpdb)[ Docs](https://php-db.dev)[ RSS](/packages/php-db-phpdb/feed)WikiDiscussions 0.6.x Synced 2d ago

READMEChangelog (10)Dependencies (10)Versions (25)Used By (10)

phpdb
=====

[](#phpdb)

The continuation of the Laminas Db component, now under the `php-db` organization.

The following information is outdated and will be updated in the coming days.

[![Build Status](https://github.com/php-db/phpdb/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/php-db/phpdb/actions/workflows/continuous-integration.yml)

`PhpDb` is a component that abstract the access to a Database using an object oriented API to build the queries. `PhpDb` consumes different storage adapters to access different database vendors such as MySQL, PostgreSQL, Oracle, IBM DB2, Microsoft Sql Server, PDO, etc.

Contributing
------------

[](#contributing)

Please be sure to read the [contributor's guide](https://github.com/php-db/.github/blob/main/CONTRIBUTING.md) for general information on contributing. This section outlines specifics for php-db.

### Test suites

[](#test-suites)

The `phpunit.xml.dist` file defines two test suites, "unit test" and "integration test". You can run one or the other using the `--testsuite` option to `phpunit`:

```
./vendor/bin/phpunit --testsuite "unit test" # unit tests only
./vendor/bin/phpunit --testsuite "integration test" # integration tests only
```

Unit tests do not require additional functionality beyond having the appropriate database extensions present and loaded in your PHP binary.

#### Integration tests

[](#integration-tests)

To run the integration tests, you need databases. So, the repository includes a [Docker Compose](https://docs.docker.com/compose/intro/features-uses/) configuration which allows you to start a test environment that provides several of our target databases, including *MySQL* and *PostgreSQL*, and SQLite.

To start up the configuration, run the following command:

```
docker compose up -d
```

To test that the environment is up and running, run the following command:

```
docker compose ps
```

You should see output similar to the following:

```
docker compose ps
NAME                      IMAGE                                            COMMAND                SERVICE      CREATED       STATUS       PORTS
laminas-db-mysql-1        docker.io/library/laminas-db-mysql:latest        "mysqld"               mysql        7 hours ago   Up 7 hours
laminas-db-php-1          docker.io/library/laminas-db-php:latest          "apache2-foreground"   php          7 hours ago   Up 7 hours
laminas-db-postgresql-1   docker.io/library/laminas-db-postgresql:latest   "postgres"             postgresql   7 hours ago   Up 7 hours
```

If you see three containers listed, then they're all running, and you are ready to run the test suite. So, copy `phpunit.xml.dist` to `phpunit.xml`, and change the following environment variable to "true" to enable the three databases:

- TESTS\_PHPDB\_ADAPTER\_DRIVER\_MYSQL
- TESTS\_PHPDB\_ADAPTER\_DRIVER\_PGSQL
- TESTS\_PHPDB\_ADAPTER\_DRIVER\_SQLITE\_MEMORY

From there, you can run the integration tests by running the following command:

```
docker compose exec php composer test-integration
```

Tip

If you want to grow your Docker Compose knowledge, grab a (free) copy of [Deploy with Docker Compose](https://deploywithdockercompose.com).

---

- File issues at
- Documentation is at

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance58

Moderate activity, may be stable

Popularity44

Moderate usage in the ecosystem

Community34

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60.2% 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 ~19 days

Recently: every ~48 days

Total

18

Last Release

2d ago

PHP version history (3 changes)0.1.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0

0.2.0PHP ~8.2.0 || ~8.3.0 || ~8.4.0

0.3.0PHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/4d6eed33e61a99f1147789696252f4523130b5035a19eb07e034a7407fd44548?d=identicon)[tyrsson](/maintainers/tyrsson)

---

Top Contributors

[![weierophinney](https://avatars.githubusercontent.com/u/25943?v=4)](https://github.com/weierophinney "weierophinney (4941 commits)")[![Maks3w](https://avatars.githubusercontent.com/u/1301698?v=4)](https://github.com/Maks3w "Maks3w (649 commits)")[![Ocramius](https://avatars.githubusercontent.com/u/154256?v=4)](https://github.com/Ocramius "Ocramius (568 commits)")[![ezimuel](https://avatars.githubusercontent.com/u/475967?v=4)](https://github.com/ezimuel "ezimuel (321 commits)")[![simon-mundy](https://avatars.githubusercontent.com/u/46739456?v=4)](https://github.com/simon-mundy "simon-mundy (264 commits)")[![tyrsson](https://avatars.githubusercontent.com/u/1237487?v=4)](https://github.com/tyrsson "tyrsson (220 commits)")[![michalbundyra](https://avatars.githubusercontent.com/u/7423207?v=4)](https://github.com/michalbundyra "michalbundyra (193 commits)")[![EvanDotPro](https://avatars.githubusercontent.com/u/5607?v=4)](https://github.com/EvanDotPro "EvanDotPro (179 commits)")[![akrabat](https://avatars.githubusercontent.com/u/33135?v=4)](https://github.com/akrabat "akrabat (153 commits)")[![mwillbanks](https://avatars.githubusercontent.com/u/38209?v=4)](https://github.com/mwillbanks "mwillbanks (106 commits)")[![samsonasik](https://avatars.githubusercontent.com/u/459648?v=4)](https://github.com/samsonasik "samsonasik (103 commits)")[![ralphschindler](https://avatars.githubusercontent.com/u/76674?v=4)](https://github.com/ralphschindler "ralphschindler (66 commits)")[![marc-mabe](https://avatars.githubusercontent.com/u/302689?v=4)](https://github.com/marc-mabe "marc-mabe (45 commits)")[![turrsis](https://avatars.githubusercontent.com/u/2911165?v=4)](https://github.com/turrsis "turrsis (43 commits)")[![leftbrained](https://avatars.githubusercontent.com/u/1720071?v=4)](https://github.com/leftbrained "leftbrained (40 commits)")[![romulobusatto](https://avatars.githubusercontent.com/u/2951677?v=4)](https://github.com/romulobusatto "romulobusatto (39 commits)")[![kabel](https://avatars.githubusercontent.com/u/675956?v=4)](https://github.com/kabel "kabel (35 commits)")[![sgehrig](https://avatars.githubusercontent.com/u/43394?v=4)](https://github.com/sgehrig "sgehrig (33 commits)")[![DASPRiD](https://avatars.githubusercontent.com/u/233300?v=4)](https://github.com/DASPRiD "DASPRiD (29 commits)")[![Freeaqingme](https://avatars.githubusercontent.com/u/33034?v=4)](https://github.com/Freeaqingme "Freeaqingme (24 commits)")

---

Tags

laminasdbmezziophp-db

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[laminas/laminas-db

Database abstraction layer, SQL abstraction, result set abstraction, and RowDataGateway and TableDataGateway implementations

14023.5M235](/packages/laminas-laminas-db)[laminas/laminas-validator

Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria

15848.2M222](/packages/laminas-laminas-validator)[doctrine/doctrine-module

Laminas Module that provides Doctrine basic functionality required for ORM and ODM modules

4048.2M122](/packages/doctrine-doctrine-module)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

5.1k5.2k](/packages/shlinkio-shlink)[laminas/laminas-router

Flexible routing system for HTTP and console applications

3522.5M76](/packages/laminas-laminas-router)[samsonasik/error-hero-module

A Hero for your Laminas and Mezzio application to trap php errors &amp; exceptions

5233.6k1](/packages/samsonasik-error-hero-module)

PHPackages © 2026

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