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

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

asgard/db
=========

v0.3.1(10y ago)01.1k5MITPHPPHP &gt;=5.5.9

Since Sep 9Pushed 7y agoCompare

[ Source](https://github.com/asgardphp/db)[ Packagist](https://packagist.org/packages/asgard/db)[ RSS](/packages/asgard-db/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (5)

\#Database

[![Build Status](https://camo.githubusercontent.com/8c8343180b2741d3506be73638ceba72ab8f861b3d81de27243961fe8675bfc0/68747470733a2f2f7472617669732d63692e6f72672f6173676172647068702f64622e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/asgardphp/db)

The DB package lets you manipulate the database, build SQL queries and manipulate the tables structure with Schema.

\##Installation **If you are working on an Asgard project you don't need to install this library as it is already part of the standard libraries.**

```
composer require asgard/db 0.*

```

\##DB

To connect to the database and make SQL queries. [See the documentation.](docs/db-db)

```
$rows = $db->query('SELECT * FROM news ORDER BY id DESC')->all();

```

\##DAL

To build SQL queries in a Object-Oriented manner. [See the documentation.](docs/db-dal)

```
$rows = $db-dal->from('news')->orderBy('id DESC')->all();

```

\##Schema

Build, modify and drop tables. [See the documentation.](docs/db-schema)

```
schema->table('news', function($table) {
	$table->addColumn('id', 'integer', [
		'length' => 11,
		'autoincrement' => true,
	]);
	$table->addColumn('created_at', 'datetime', [
	]);
	$table->addColumn('updated_at', 'datetime', [
	]);
	$table->addColumn('title', 'string', [
		'length' => '255',
	]);

	$table->setPrimaryKey(['id']);
});

```

\##Commands

[List of commands that come with the DB package.](docs/db-commands)

\###Contributing

Please submit all issues and pull requests to the [asgardphp/asgard](http://github.com/asgardphp/asgard) repository.

### License

[](#license)

The Asgard framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.9% 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 ~204 days

Total

4

Last Release

3655d ago

PHP version history (2 changes)v0.1.0PHP &gt;=5.4.0

v0.3.0PHP &gt;=5.5.9

### Community

Maintainers

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

---

Top Contributors

[![h0gar](https://avatars.githubusercontent.com/u/439138?v=4)](https://github.com/h0gar "h0gar (176 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")

### Embed Badge

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

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

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