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

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

netherphp/database
==================

A database connection and query tool.

v4.1.11(3y ago)22.8k[1 issues](https://github.com/netherphp/database/issues)[1 PRs](https://github.com/netherphp/database/pulls)1BSD-2-ClausePHPPHP &gt;=8.1.0CI passing

Since Mar 4Pushed 3mo agoCompare

[ Source](https://github.com/netherphp/database)[ Packagist](https://packagist.org/packages/netherphp/database)[ RSS](/packages/netherphp-database/feed)WikiDiscussions redux Synced 1mo ago

READMEChangelogDependencies (7)Versions (37)Used By (1)

Nether Database
===============

[](#nether-database)

[![Packagist](https://camo.githubusercontent.com/210e2eb3f7a3b41ceba2925766f77a50c9952b59b32ccfd3aff7ff024a54fa98/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e65746865727068702f64617461626173652e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/netherphp/database)[![Build Status](https://camo.githubusercontent.com/b9b01a9d03d2ce5989aac33a6196546904773e81ccb8217dd658645b7dbc9764/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e65746865727068702f64617461626173652f706870756e69742e796d6c3f7374796c653d666f722d7468652d6261646765)](https://github.com/netherphp/database/actions)[![codecov](https://camo.githubusercontent.com/81879b2c5b46f2bef8d91a2c205f55cc580a99098c4181209c1ec0c0bd4d5c1b/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f67682f6e65746865727068702f64617461626173653f7374796c653d666f722d7468652d626164676526746f6b656e3d5651433438584e425332)](https://codecov.io/gh/netherphp/database)

A lower-level database connection and query library. Provides a simple API for connecting, querying, and digesting the results from a database server.

Requirements
------------

[](#requirements)

- PHP 8.1+
- PDO

Supported Servers
-----------------

[](#supported-servers)

### Basic Connect/Query

[](#basic-connectquery)

- Anything PDO on the system can connect to.
- And you wrote SQL that executes upon it.
- See [Quickstart Guide](https://github.com/netherphp/database/wiki/Quickstart-Guide) for visual examples.

### SQL Generator (Verse)

[](#sql-generator-verse)

To use the SQL abstractor there will need to be a compiler written for that server to make it generate using the proper and best keywords available supported by that server.

- MySQL / MariaDB (PDO Driver: 'mysql')
- See [Verse SQL Generator](https://github.com/netherphp/database/wiki/Verse-SQL-Generator) for examples.

Command Line Interface
----------------------

[](#command-line-interface)

This library also sets up a `netherdb` command in `vendor/bin` to help get various tasks done.

- See [NetherDB Command Line](https://github.com/netherphp/database/wiki/NetherDB-Command-Line) for examples.

Additional Libraries
--------------------

[](#additional-libraries)

To do its work Nether Database will also include the following NetherPHP libraries. There is no danger of your application suddenly becoming a "NetherPHP" application though. These are all utility which are there for you to use as well, if desired, as they will be about anyway.

- netherphp/option (configuration management)
- netherphp/console (cli library)
- netherphp/object (prototyping)

Classes &amp; Interfaces
========================

[](#classes--interfaces)

`Database\Prototype`
--------------------

[](#databaseprototype)

This class adds basic database search and manipulation on top of the `Common\Prototype` features. Use it as a base class to get all the functionaility of `Common` and `Database` together.

### `Database\Prototype::Find(iterable $Filters)`

[](#databaseprototypefinditerable-filters)

This method provides the basic paginated search ability. Given a set of filters classes that extend this class can decide what to do about them. There are also some special filters that apply across all:

> `'Page' => 1, 'Limit' => 20`

These are the main pagination filters.

> `'Seed' => 1234`

A seed to use for any RNG based operations. If fed a value that only changes once per day, you can query with a `Sort` of `random` and it will return the same rows that entire day.

> `'Remappers' => [ callable, ... ]`

Give it a callable, or array of, and it will be used as a `Remap` callable upon the result datastore. Useful for searching on a class that links two objects together, but mapping the result down to only the parts of the data that were needed.

> `'Resolvers' => [ callable, ... ]`

Normally each row of the result set is instantiated to be an object of the class that performed the search. When given a list of callables, it will give them the row as it came out of the database. If it returns the name of a valid class (string) it will be used to instantiate this row. If it returns NULL the next callable in the list will be given a shot.

This can be useful to optimise some searches on a parent class that can spit out a collection of various child typed rows.

> `'Sort' => 'how'`

Select the sort method to use in this search. This class provides default implementations for `pk-az`, `pk-za`, and `random`. More sorts can be provided by child classes.

> `'Debug' => TRUE`

When enabled this will attach the query result object to the collection so it can be inspected.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance43

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

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

Total

33

Last Release

1167d ago

Major Versions

v1.1.6 → v2.0.02016-02-26

v2.0.3 → v3.0.02017-08-18

v3.0.3 → v4.0.02021-01-08

PHP version history (5 changes)v1.0.0PHP &gt;=5.4.0

v2.0.0PHP &gt;=7.0.0

v3.0.0PHP &gt;=7.1.0

v4.0.1PHP &gt;=8.0.0

v4.1.5PHP &gt;=8.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b64ee49e86efa67a7de4afdc42c2686460d1e46ac7eac7e6ccfa6407ec7d979a?d=identicon)[bobmagicii](/maintainers/bobmagicii)

---

Top Contributors

[![bobmagicii](https://avatars.githubusercontent.com/u/881944?v=4)](https://github.com/bobmagicii "bobmagicii (191 commits)")

---

Tags

phpdatabase

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[webparking/laravel-type-safe-collection

This package provides type-safe extension of the laravel collection, forcing a single type of object.

378.2k](/packages/webparking-laravel-type-safe-collection)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1814.6k11](/packages/popphp-pop-db)[modul-is/orm

Lightweight hybrid ORM/Explorer

1118.1k](/packages/modul-is-orm)[jonas-elias/hyperf-oracle

A oracle handler for hyperf/database.

102.0k](/packages/jonas-elias-hyperf-oracle)

PHPackages © 2026

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