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.0k↓50%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 1mo 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 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

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

3164d 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

[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)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

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

Reliese Components for Laravel Framework code generation.

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

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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