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

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

digitaldream/dbreader
=====================

Database Reader

1.4(8y ago)821.7k↑189.3%11MITPHP

Since Sep 12Pushed 8y ago1 watchersCompare

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

READMEChangelog (5)DependenciesVersions (6)Used By (1)

For some kind of automation tools we need to know database constraints like tables, fields and its indexes. But its very hard and painful to get this information from directly database. This tool will make this task super simple.

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

[](#installation)

Add this line on your composer.json

```
    "require":{
        "digitaldream/dbreader":"~1.0"
    }
```

Settings
--------

[](#settings)

Set Database information on top of page.

```
\DbReader\Database::settings([
    'database' => "YOUR_DATABASE_NAME",
    'username' => "YOUR_DATABASE_USERNAME",
    'password' => "YOUR_DATABSE_PASSWORD",
    // or you can just assign a pdo object via
    // 'pdo'=> $your_pdo_object
    //Below are optional columns
    'manualRelations' => [
        'tours.start_location' => 'locations.id',
        'tours.end_location' => 'locations.id'
    ],
    'ignore' => [],
    'protectedColumns' => ['id', 'created_at', 'updated_at'],
    'files' => ['users.avatar']
]);
```

### Database

[](#database)

```
$db=new \DbReader\Database();
print_r($db->tables()); // return array of tables
// You can also access a individual table object
print_r($db->users); // It will return \DbReader\Table Object
// Even further
print_r($db->users->id) // It will return \DbReader\Column Object
```

### Table

[](#table)

```
$user=new \DbReader\Table('users');
print_r($user->columns()) // return all columns as array of StdClass
print_r($user->columnClasses()) // return list of Column Class object as array. Most preferable rather than columns()
print_r($user->relations()); // return all the Foreign Relation of a given table.
print_r($user->indexes()); // return all the Indexes of given table.
```

### Column

[](#column)

```
$user=new \DbReader\Table('users');
echo $user->email->name(); // name of the column
echo $user->email->type(); // type Column data type enum, int, text etc
echo $user->email->length(); //  return length e.g. 255 for varchar
echo $user->email->defaultValue();
echo $user->email->isPk();
echo $user->email->isUnique();
echo $user->email->isNull();
echo $user->email->isForeign();
```

*N.B*: This is a submodule of [LaraCrud](https://github.com/digitaldreams/laracrud) and only Support Mysql Database now.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 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

5

Last Release

3210d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6059541?v=4)[Tuhin Bepari](/maintainers/digitaldreams)[@digitaldreams](https://github.com/digitaldreams)

---

Top Contributors

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

---

Tags

mysql-databasephp

### Embed Badge

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

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

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

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

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198741.5k12](/packages/pgvector-pgvector)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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