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

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

fraeio/database
===============

v0.2(1y ago)022GPL-3.0-or-laterPHPPHP &gt;=8.0

Since Oct 5Pushed 1y ago3 watchersCompare

[ Source](https://github.com/Fraeio/Database)[ Packagist](https://packagist.org/packages/fraeio/database)[ RSS](/packages/fraeio-database/feed)WikiDiscussions main Synced 6d ago

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

FraeCMS Database
================

[](#fraecms-database)

This package provides a simplified model for PHP MySQLi (and potentially more in the future). Intended for FraeCMS for added simplicity and security.

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

[](#installation)

### Composer

[](#composer)

`composer require fraeio/database`

### Requirements

[](#requirements)

For MySQLi functions to be available, you must enable MySQLi extension to work with your PHP instances.

> For installation instructions for MySQLi, go to: [PHP.net MySQLi Installation](http://php.net/manual/en/mysqli.installation.php "http://php.net/manual/en/mysqli.installation.php")

### Configuration

[](#configuration)

By default, FraeCMS Database will use environment variables to attempt to connect to a database server. In your .ENV file you can specify these variables:

```
DB_HOST = localhost # Specify hostname or TCP/IP of MySQL server to connect to.
DB_USER = admin # The MySQL user name.
DB_PASS = password # The MySQL password. [optionaly] provide null.
DB_NAME = FraeCMS # Specify the default database to be used when performing queries.
DB_PORT = 3306 # [optional] Specify MySQL port.
DB_CHARSET = utf8 # [optional] Set the desired charset for the database connection.
DB_PREFIX = frae_ # [optional] Prefix for database table names.`

```

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

[](#create-a-connection)

### Example #1 Connect using environment variables

[](#example-1-connect-using-environment-variables)

```
/* Load Environment Variables. */
    Dotenv::createImmutable(CONFIG_PATH, '.env')->load();

/* Connect to Database using environment variables */
    $database = new Database();

```

### Example #2 Connect using ini or other variables

[](#example-2-connect-using-ini-or-other-variables)

```
/* Connect to Database using ini variables */
    $database = new Database(
      ini_get('mysqli.default_host'),
      ini_get('mysqli.default_user'),
      ini_get('mysqli.default_pw'),
      'my_database',
      ini_get('mysqli.default_port'),
      'utf8',
      'optional_table_prefix_',
    );

```

### Example #3 Connect using an array

[](#example-3-connect-using-an-array)

```
/* Connect to Database using array variables */
    $database = new Database([
      'host': 'localhost',
      'username': 'my_user',
      'password': 'my_password',
      'dbname': 'my_database',
      'port': 3306,
      'charset': 'utf8',
      'prefix': NULL,
    ]);

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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 ~1032 days

Total

2

Last Release

653d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7281985a6dbe0890c150d6b0ca5c49a1c6aeeb0612530de132bf7a5d08e257d8?d=identicon)[LovBlueFox](/maintainers/LovBlueFox)

---

Top Contributors

[![LovBlueFox](https://avatars.githubusercontent.com/u/7298133?v=4)](https://github.com/LovBlueFox "LovBlueFox (6 commits)")

---

Tags

mariadbphp

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

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