PHPackages                             codexshaper/php-database - 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. codexshaper/php-database

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

codexshaper/php-database
========================

Laravel database and eloquent for php project.

v1.0(5y ago)05854MITPHPPHP ^7.2CI failing

Since Jun 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Codexshaper/php-database)[ Packagist](https://packagist.org/packages/codexshaper/php-database)[ Docs](https://github.com/Codexshaper/php-database)[ RSS](/packages/codexshaper-php-database/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (4)

[![License](https://camo.githubusercontent.com/1e1cb7bae9fc55a01fc5443d26e358dc21c129253bcfa9841db85c4f25aa2ecf/687474703a2f2f696d672e736869656c64732e696f2f3a6c6963656e73652d6d69742d626c75652e7376673f7374796c653d666c61742d737175617265)](http://badges.mit-license.org)[![Build Status](https://camo.githubusercontent.com/bf01834c1f4519417b9941ab13f8828fcafdcd72cc32f604ba1faed957e4abe1/68747470733a2f2f7472617669732d63692e6f72672f436f6465787368617065722f7068702d64617461626173652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Codexshaper/php-database)[![StyleCI](https://camo.githubusercontent.com/f2f1da45f59cc5967b81e738ae1f5cb113e2c2b6e83814326c60b88f7fb99b07/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3236393534383837342f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/269548874)[![Quality Score](https://camo.githubusercontent.com/d08998aeb039cfc074674c00d09f40cb98cdea03585bde9a9b565bb9d0aca3fd/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f436f6465787368617065722f7068702d64617461626173652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Codexshaper/php-database)[![Downloads](https://camo.githubusercontent.com/6abf8c3335a5810b04b38c3ae1abfa37e303afaafcbc5212c7d75662d4800ebd/68747470733a2f2f706f7365722e707567782e6f72672f436f6465787368617065722f7068702d64617461626173652f642f746f74616c2e737667)](https://packagist.org/packages/Codexshaper/php-database)[![Latest Version on Packagist](https://camo.githubusercontent.com/0309dc86942f1a3780422fa1fbbdc3174cbd95f056629e0a51e446b4ee463fb2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f436f6465787368617065722f7068702d64617461626173652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Codexshaper/php-database)

Database and ORM
================

[](#database-and-orm)

Laravel database and eloquent for php project.

Download
--------

[](#download)

```
composer require codexshaper/php-database

```

Setup root facade
-----------------

[](#setup-root-facade)

```
use Illuminate\Support\Facades\Facade;
use Illuminate\Container\Container;

Facade::setFacadeApplication(new Container);

```

Note: If you alraedy setup `container` as a root facade then leave it.

Create a new connection
-----------------------

[](#create-a-new-connection)

```
use CodexShaper\Database\Database;

```

### Using `constructor`

[](#using-constructor)

```
$db = new Database([
	"driver" 		=> "mysql",
	"host" 			=> 'localhost',
	"database" 		=> 'db_name',
	"username" 		=> 'db_user',
	"password" 		=> 'db_password',
	"prefix"   		=> 'db_prefix',
	"charset"   	=> 'utf8mb4',
	"collation"   	=> 'utf8mb4_unicode_ci',
]);

```

### Using `addConnection` method

[](#using-addconnection-method)

```
$db = new Database;
$db->addConnection([
	"driver" 		=> "mysql",
	"host" 			=> 'localhost',
	"database" 		=> 'laravel-woocommerce',
	"username" 		=> 'root',
	"password" 		=> '',
	"prefix"   		=> 'wp_',
	"charset"   	=> 'utf8mb4',
	"collation"   	=> 'utf8mb4_unicode_ci',
]);

```

Finaly `run` database to use globally and setup eloquent orm
------------------------------------------------------------

[](#finaly-run-database-to-use-globally-and-setup-eloquent-orm)

```
$db->run();

```

Create a table
--------------

[](#create-a-table)

```
use CodexShaper\Database\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;

Schema::create('users', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->string('email')->unique();
    $table->timestamp('email_verified_at')->nullable();
    $table->string('password');
    $table->rememberToken();
    $table->timestamps();
});

```

Drop a table
------------

[](#drop-a-table)

```
use CodexShaper\Database\Facades\Schema;
Schema::dropIfExists('custom_options');

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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

2174d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/88afdef32d0b9f6870f60d470bd66609c03fa02643393a7ee4c4de50dc390e3d?d=identicon)[Codexshaper](/maintainers/Codexshaper)

---

Top Contributors

[![Codexshaper](https://avatars.githubusercontent.com/u/49456098?v=4)](https://github.com/Codexshaper "Codexshaper (6 commits)")[![maab16](https://avatars.githubusercontent.com/u/20833514?v=4)](https://github.com/maab16 "maab16 (2 commits)")

---

Tags

databaseeloquentmigrationormphpphplaraveldatabaseormeloquent

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/codexshaper-php-database/health.svg)

```
[![Health](https://phpackages.com/badges/codexshaper-php-database/health.svg)](https://phpackages.com/packages/codexshaper-php-database)
```

###  Alternatives

[spiritix/lada-cache

A Redis based, automated and scalable database caching layer for Laravel

591444.8k2](/packages/spiritix-lada-cache)[ymigval/laravel-model-cache

Laravel package for caching Eloquent model queries

7642.2k3](/packages/ymigval-laravel-model-cache)[wayofdev/laravel-cycle-orm-adapter

🔥 A Laravel adapter for CycleORM, providing seamless integration of the Cycle DataMapper ORM for advanced database handling and object mapping in PHP applications.

3516.7k3](/packages/wayofdev-laravel-cycle-orm-adapter)[guidocella/eloquent-populator

Guess attributes for Eloquent model factories

7661.6k2](/packages/guidocella-eloquent-populator)[sebastiaanluca/laravel-boolean-dates

Automatically convert Eloquent model boolean attributes to dates (and back).

40111.7k1](/packages/sebastiaanluca-laravel-boolean-dates)[matchory/elasticsearch

The missing elasticsearch ORM for Laravel!

3059.0k](/packages/matchory-elasticsearch)

PHPackages © 2026

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