PHPackages                             rotexsoft/gdao - 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. rotexsoft/gdao

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

rotexsoft/gdao
==============

A package containing class and interface definitions that can be used as a basis for a Table Data Gateway (http://bit.ly/1F8Zjfc) and Data Mapper (http://bit.ly/1hD2qCc) implementation of a database access library that performs data manipulation (DM) tasks.

4.0.1(5mo ago)13.4k↓86.3%[3 issues](https://github.com/rotexsoft/gdao/issues)1BSD-3-ClausePHPPHP &gt;=8.2CI passing

Since Aug 25Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/rotexsoft/gdao)[ Packagist](https://packagist.org/packages/rotexsoft/gdao)[ Docs](https://github.com/rotexsoft/gdao)[ RSS](/packages/rotexsoft-gdao/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (4)Versions (27)Used By (1)

Generic Data Access Objects (GDAO)
==================================

[](#generic-data-access-objects-gdao)

[![Run PHP Tests and Code Quality Tools](https://github.com/rotexsoft/gdao/actions/workflows/php.yml/badge.svg)](https://github.com/rotexsoft/gdao/actions/workflows/php.yml) [![GitHub release (latest SemVer)](https://camo.githubusercontent.com/149d542e9330d5974b7763d1b817c7c5afa239046bf96a635029e691a6d2dc23/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f726f746578736f66742f6764616f)](https://camo.githubusercontent.com/149d542e9330d5974b7763d1b817c7c5afa239046bf96a635029e691a6d2dc23/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f726f746578736f66742f6764616f) [![GitHub](https://camo.githubusercontent.com/1e26a672b00f7c0e8024e51eb4895954fbfdf669b12a325d38fedd235a6045d6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f726f746578736f66742f6764616f)](https://camo.githubusercontent.com/1e26a672b00f7c0e8024e51eb4895954fbfdf669b12a325d38fedd235a6045d6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f726f746578736f66742f6764616f) [![Coverage Status](https://camo.githubusercontent.com/83880b2674e9471425379cd4f5bb47ea6eeb54166a5ec5211342e443b2e1e7d8/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f726f746578736f66742f6764616f2f62616467652e737667)](https://coveralls.io/github/rotexsoft/gdao) [![GitHub repo size](https://camo.githubusercontent.com/8f43730d3b101b930c59aa680e8a4bd926b730426524a278216bfc18e4b13621/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f726f746578736f66742f6764616f)](https://camo.githubusercontent.com/8f43730d3b101b930c59aa680e8a4bd926b730426524a278216bfc18e4b13621/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f726f746578736f66742f6764616f) [![Packagist Downloads](https://camo.githubusercontent.com/6f37b8b632039c4d93d73914edd504efdcb52636db61a6f8917bb742d67909ba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f746578736f66742f6764616f)](https://camo.githubusercontent.com/6f37b8b632039c4d93d73914edd504efdcb52636db61a6f8917bb742d67909ba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f746578736f66742f6764616f) [![GitHub top language](https://camo.githubusercontent.com/46c8451e4025e6683ddf66775197be4c517c1dd6c23fd100918170c2eed40723/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f726f746578736f66742f6764616f)](https://camo.githubusercontent.com/46c8451e4025e6683ddf66775197be4c517c1dd6c23fd100918170c2eed40723/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f726f746578736f66742f6764616f) [![Packagist PHP Version Support](https://camo.githubusercontent.com/706544cb628e68bfdc81de7952ee4874148d83c816435358760b79350382f74c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f726f746578736f66742f6764616f)](https://camo.githubusercontent.com/706544cb628e68bfdc81de7952ee4874148d83c816435358760b79350382f74c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f726f746578736f66742f6764616f) [![GitHub commits since latest release (by date)](https://camo.githubusercontent.com/09bca01171c7b371ed9911d298822ea4f0f15527fd7da11fb71543a4b6c8a3c6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f726f746578736f66742f6764616f2f6c6174657374)](https://camo.githubusercontent.com/09bca01171c7b371ed9911d298822ea4f0f15527fd7da11fb71543a4b6c8a3c6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f726f746578736f66742f6764616f2f6c6174657374) [![GitHub last commit](https://camo.githubusercontent.com/b36c2959592c1ba1c7e9f7e8a0a382ec9f46daeb4138383a6905fe665f463fe0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f726f746578736f66742f6764616f)](https://camo.githubusercontent.com/b36c2959592c1ba1c7e9f7e8a0a382ec9f46daeb4138383a6905fe665f463fe0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f726f746578736f66742f6764616f) [![GitHub Release Date](https://camo.githubusercontent.com/67a3e1dd8b1035debdd67869796f669f3ad57808022b62cb213f660f09a14a8f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f726f746578736f66742f6764616f)](https://camo.githubusercontent.com/67a3e1dd8b1035debdd67869796f669f3ad57808022b62cb213f660f09a14a8f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f726f746578736f66742f6764616f) [![Libraries.io dependency status for GitHub repo](https://camo.githubusercontent.com/818a2b0e0c9dd6716ed7a2a3920f88de307269c7351450f3df5a055a628af1f9/68747470733a2f2f696d672e736869656c64732e696f2f6c6962726172696573696f2f6769746875622f726f746578736f66742f6764616f)](https://libraries.io/packagist/rotexsoft%2Fgdao)

Description
-----------

[](#description)

A package containing class and interface definitions that can be used as a basis for a **Table Data Gateway** () and **Data Mapper** () implementation of a database access library that performs data manipulation (DM) tasks. Below are its main components:

- an abstract **Model** class (it's the **Table Data Gateway** and **Data Mapper** that interacts with a database table by performing DM tasks like Selection, Insertion, Deletion &amp; Updating of data)
- a **RecordInterface** interface (contains definitions of methods that any class **representing a row of data in a database table**, MUST IMPLEMENT. Such classes can only access a database table via an instance of the Model class)
- an optional **CollectionInterface** interface (contains definitions of methods that any class that is to **serve as a collection of multiple instances of RecordInterface objects**, MUST IMPLEMENT)

This API is intended to make it easy / trivial to swap out different implementations of each of the Main classes. For example, an application may have been written to use a package that implements this API in the following classes: **ModelYY**, **CollectionYY** (which implements **CollectionInterface**) and **RecordYY** (which implements **RecordInterface**). In the future if another package implementing this API has a **ModelZZ** which performs some operations more efficiently than **ModelYY**, you should be able to easily substitute **ModelYY** with **ModelZZ** if all your data access code strictly adheres to the GDAO API (you would now end up using **ModelZZ**, **CollectionYY**and **RecordYY** in your updated code; which should all work nicely together).

This package isn't meant to perform database schema management tasks like creating/altering tables, etc. However, it exposes a PDO object (via **\\GDAO\\Model-&gt;getPDO()**) that can be used to perform such tasks and other data manipulation (DM) tasks that cannot be accomplished via this API.

[![GDAO Classes & Interfaces](class-diagram.svg)](class-diagram.svg)

Assumptions and Conventions in this API.
----------------------------------------

[](#assumptions-and-conventions-in-this-api)

- Each database table has a single auto-incrementing numeric primary key column (composite primary keys are not supported; however a single primary key column that is non-numeric should work)
- Implementation(s) of this API must be powered by at least one PDO object. Vendor specific php database extensions (eg. mysqli, SQLite3 etc.) are not to be used in implementation(s) of this API.
- This API is architected with the intent of having Records and Collections created via the Model.

> Users of any implementation of this API should not be directly instantiating new Collections or Records via their constructors, instead they should create them by calling the appropriate implementation of \\GDAO\\Model::createCollection(..) or \\GDAO\\Model::createRecord(..).

Definition of terms used in the phpdoc comment blocks:
------------------------------------------------------

[](#definition-of-terms-used-in-the-phpdoc-comment-blocks)

- **Consumer:** an individual developer or group of developers that use a package / library containing concrete implementation of the APIs specified in the abstract classes in this package.
- **Implementer:** The developer that creates a package / library containing concrete implementation of the APIs specified in the abstract classes in this package.

Running Tests
-------------

[](#running-tests)

` ./vendor/bin/phpunit --coverage-text`

Branching
---------

[](#branching)

These are the branches in this repository:

- **master:** contains code for the latest major version of this package
- **3.x:** contains code for the **2.x** version of this package
- **2.x:** contains code for the **2.x** version of this package
- **1.X:** contains code for the **1.x** version of this package. This version never got a stable release and has been abandoned

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance53

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity86

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

Recently: every ~158 days

Total

26

Last Release

151d ago

Major Versions

1.1.1-RC1 → 2.0.0-RC12022-11-07

2.2.1 → 3.0.0-RC12023-05-09

2.x-dev → 3.x-dev2025-06-26

3.x-dev → 4.0.02026-01-22

PHP version history (7 changes)1.0.0-RC1PHP &gt;=5.3.0

1.0.0-RC2PHP &gt;=5.4.0

1.1.0-RC1PHP &gt;=5.6.0

1.1.1-RC1PHP &gt;=7.2

2.0.0-RC1PHP &gt;=7.4

3.0.0-RC1PHP &gt;=8.1

4.0.0PHP &gt;=8.2

### Community

Maintainers

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

---

Top Contributors

[![rotexdegba](https://avatars.githubusercontent.com/u/1242622?v=4)](https://github.com/rotexdegba "rotexdegba (205 commits)")

---

Tags

datadatabaseormmysqlsqlitepostgresqlsqlpdodbmappergatewaydata mappertabletable data gateway

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rotexsoft-gdao/health.svg)

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

###  Alternatives

[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4563.1M37](/packages/aura-sqlquery)[cycle/orm

PHP DataMapper ORM and Data Modelling Engine

1.3k888.3k73](/packages/cycle-orm)[atlas/query

Object-oriented query builders and performers for MySQL, Postgres, SQLite, and SQLServer.

41253.7k7](/packages/atlas-query)[aura/sqlschema

Provides facilities to read table names and table columns from a database using PDO.

41240.2k4](/packages/aura-sqlschema)[delight-im/db

Safe and convenient SQL database access in a driver-agnostic way

47165.7k7](/packages/delight-im-db)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

816.0k](/packages/tommyknocker-pdo-database-class)

PHPackages © 2026

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