PHPackages                             wcatron/common-db-framework - 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. [Framework](/categories/framework)
4. /
5. wcatron/common-db-framework

ActiveLibrary[Framework](/categories/framework)

wcatron/common-db-framework
===========================

Common classes shared between DB Frameworks that want to link between each other.

0.1.2(10y ago)02862MITPHPPHP &gt;=5.3.0

Since Feb 23Pushed 10y ago1 watchersCompare

[ Source](https://github.com/wcatron/Common-DB-Framework-PHP)[ Packagist](https://packagist.org/packages/wcatron/common-db-framework)[ RSS](/packages/wcatron-common-db-framework/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (9)Used By (2)

Common DB Framework
===================

[](#common-db-framework)

Common classes shared between DB Frameworks that want to link between each other.

Getting Started
---------------

[](#getting-started)

Common DB is not a database connection itself, instead it serves as a starting point for various DB frameworks. Currently there are two:

- [MongoDB Framework](https://github.com/wcatron/MongoDB-Framework-PHP)
- [MySQL Framework](https://github.com/wcatron/MySQL-Framework-PHP)
- *Coming Soon: Postgres Framework*

Default Hierarchy
-----------------

[](#default-hierarchy)

Any framework will need a Database class that inherits the `DB` class and handles the connection to the database. Then there needs to be a default object class that handles specific object related tasks unique to your database type. For example in MongoDB (a document based database) the default object class is `Document` all classes using that framework will inherit from that class. For MySQL the default object class is `Row`. These classes should also set the `$dbClass`static variable to your frameworks class that inherits `DB`. This allows for dependency injection later on. How the framework is used from this point is dependant on the framework.

### LinkedObject

[](#linkedobject)

If setup properly there are helpful classes like LinkedObject which can be used to link a DBObject from one framework/DB to a DBObject from a different framework. Examples can be found in the MongoDB and MySQL frameworks.

Singleton vs Dependency Injection
---------------------------------

[](#singleton-vs-dependency-injection)

DB instances can be accessed by using `DB::getInstance()` which will access a singleton instance of the DB framework. However Common DB has built in support for Dependency Injection. When in a DBObject class use `static::getDBInstance()`to access the DB object being used for that class. This means you can setup a TestDB class that forces a particular output and then call your default object class setDBInstance() function (i.e. `Row::setDBInstance(TestDB::class)`) to inject the dependency. This *will* setup a singleton, but it will be a new singleton and can be of any class that inherits DB.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 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 ~1 days

Total

8

Last Release

3719d ago

### Community

Maintainers

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

---

Top Contributors

[![wcatron](https://avatars.githubusercontent.com/u/5385284?v=4)](https://github.com/wcatron "wcatron (1 commits)")

---

Tags

phpframeworkdatabasecommonodmObject Based

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wcatron-common-db-framework/health.svg)

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

###  Alternatives

[utopia-php/database

A simple library to manage application persistence using multiple database adapters

74327.7k5](/packages/utopia-php-database)

PHPackages © 2026

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