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

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

verysimple/db-reflector
=======================

Allows a cross-vendor API to view database schema information

1.0.0(10y ago)023PHPPHP &gt;=5.4.0

Since Jan 5Pushed 10y ago2 watchersCompare

[ Source](https://github.com/verysimple/db-reflector)[ Packagist](https://packagist.org/packages/verysimple/db-reflector)[ RSS](/packages/verysimple-db-reflector/feed)WikiDiscussions master Synced yesterday

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

Verysimple DB Reflector
=======================

[](#verysimple-db-reflector)

DB Reflector inspects a database schema and converts it into a simple collection of arrays and objects that can be easily inspected. This includes information about columns, keys and table relationships.

DB Reflector neutralizes vendor-specific information and provides a consistent schema for all supported databases. Some possible uses for this Reflector are for building a generic DB editor or a code generator.

Databases currently supported are MySQL and Postgres. SQLite is being worked on.

Available on [packagist.org](https://packagist.org/packages/verysimple/db-reflector).

Installation
------------

[](#installation)

Install DB Reflector class with composer:

```
composer require verysimple/db-reflector

```

For automatic installation, include the project in your composer.json (it is only necessary in require-dev):

```
{
	"require-dev": {
		"verysimple/db-reflector": ">=1.0.0"
	}
}

```

Usage
-----

[](#usage)

```
// the reflector object handles the connection
$r = new Reflector('dsn', 'username', 'password');

// The DB name is specified in the DSN
$db = $r->getDB();

// enumerate through all of the tables
foreach ($tables as $table) {

	// getPrimaryKey returns an array of 0 or more Column objects
	$key = $table->getPrimaryKey();

	// columns is an array of Column objects
	$columns = $table->GetColumns();

	// relationships is an array of Relationship objects
	$relationships = $table->getRelationships();

}

```

Running Unit Tests
------------------

[](#running-unit-tests)

First clone repository. For first initial install:

```
composer install

```

To refresh autoloader:

```
composer dumpautoload

```

- Run DB setup scripts in /assets/sql
- create file phpunit\_connection.php in root directory
- see phpunit\_bootstrap.php for instructions

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3831d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/313176?v=4)[Jason Hinkle](/maintainers/jasonhinkle)[@jasonhinkle](https://github.com/jasonhinkle)

---

Top Contributors

[![jasonhinkle](https://avatars.githubusercontent.com/u/313176?v=4)](https://github.com/jasonhinkle "jasonhinkle (10 commits)")

### Embed Badge

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

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

###  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)
