PHPackages                             angujo/dbreader - 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. angujo/dbreader

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

angujo/dbreader
===============

A database interfacing library to provide an interface to the DB structure

0122PHPCI failing

Since Apr 25Pushed 6y ago1 watchersCompare

[ Source](https://github.com/angujo/dbreader)[ Packagist](https://packagist.org/packages/angujo/dbreader)[ RSS](/packages/angujo-dbreader/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

dbreader
========

[](#dbreader)

About
-----

[](#about)

A Php library for reading through the database structure. Useful for generating models based on a given Database structure. For relational databases.

DB support
----------

[](#db-support)

- PostgreSQL
- MySQL
- SQL Server

use
---

[](#use)

### setup

[](#setup)

```
composer require angujo/dbreader

```

After getting the library into your project, need to setup the database connection. You can do a **static connection** setup by modifying the config file at `src/configs.php`

```
return [
  'dbms' => 'postgres',  // postgres/pgsql for postgres, mysql for MySQL
  'host' => 'localhost',
  'port' => '5432',
  'database' => 'dvdrental',
  'username' => 'postgres',
  'password' => 'postgres',
  'charset' => 'utf8mb4',
  'options' => [],
];

```

**On the fly** by calling the `Config` class methods; Setup at once

```
Config::dns($dns_string,$username,$password);
// E.g. Config::dns('mysql:dbname=test;host:localhost;...','root','...');

```

or you can always change configuration on the fly;

```
Config::dbms($dbms);
Config::host($host);
Config::port($port);
Config::database($database);
Config::username($username);
Config::password($password);

```

and always retrieve details by calling either. to get host call `Config::host();`If you already have a PDO connection running set it up for connection as

```
Connection::setPDO($pdo,'client');

```

### Up and running

[](#up-and-running)

Get current Database

```
  $db= Connection::currentDatabase(); // $db = [Database()]

```

You can always call any database by initiating a new database;

```
$db=new Database($db_name);

```

Get tables;

```
$tables=$db->tables; // An array|Collection of tables i.e. DBTable[]|Tightenco\Collect\Support\Collection

```

You can also get all columns for a given database: `$db->columns; // DBColumn[]`For a given table, you can retrieve columns using `$table->columns`To get relations from a given table; **one to one relations**

```
$table->$foreign_keys_one_to_one; // returns ForeignKey[]

```

**one to many relations**

```
$table->$foreign_keys_one_to_many; // returns ForeignKey[]

```

WILL DO MORE DOCUMENTATION WITH TIME ... If interested, check out the code for variables accessible via the respective classes...

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9949636?v=4)[angujo](/maintainers/angujo)[@angujo](https://github.com/angujo)

---

Top Contributors

[![angujo](https://avatars.githubusercontent.com/u/9949636?v=4)](https://github.com/angujo "angujo (33 commits)")

### Embed Badge

![Health badge](/badges/angujo-dbreader/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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