PHPackages                             wcatron/mysql-db-framework - 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. wcatron/mysql-db-framework

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

wcatron/mysql-db-framework
==========================

A MySQL ODM (assistant) extremely flexible for any project.

0.2.2(9y ago)1109[1 issues](https://github.com/wcatron/MySQL-Framework-PHP/issues)MITPHPPHP &gt;=5.5

Since Feb 25Pushed 9y ago1 watchersCompare

[ Source](https://github.com/wcatron/MySQL-Framework-PHP)[ Packagist](https://packagist.org/packages/wcatron/mysql-db-framework)[ RSS](/packages/wcatron-mysql-db-framework/feed)WikiDiscussions master Synced 2mo ago

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

MySQL Framework PHP
===================

[](#mysql-framework-php)

A MySQL ODM (assistant) extremely flexible for any project.

[![Build Status](https://camo.githubusercontent.com/2ab741f93d2a23a7230ae9c884493ef53fb3f6ab9fdf6ececd1c040f2d605eff/68747470733a2f2f7472617669732d63692e6f72672f77636174726f6e2f4d7953514c2d4672616d65776f726b2d5048502e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/wcatron/MySQL-Framework-PHP)

Overview

This framework allows you to quickly map objects to rows in a MySQL database.

**Setup**

Create models for your objects and have them extend *Row*. Implement the `toRow` and `fromRow` methods and set the `TABLE` and `ID_COLUMN` constants. Call `MyDB::configure()` in your autoload.php file or wherever needed before database calls. You can now perform queries and get php objects back.

Installation
============

[](#installation)

Composer
--------

[](#composer)

```
composer require wcatron/mysql-db-framework

```

Models &amp; MDB
================

[](#models--mdb)

### Models

[](#models)

Your classes. Add two functions and two constants and allow any model to create objects.

```
class Your Class extends Row {
    /** @var LinkedObject */
    var $linkedObject;

    const TABLE = "table";
    const ID_COLUMN = "table_id";

    function __construct() {
        $this->setObjectForKey(LinkedObjectClass::class, 'linked_id', 'linkedObject');
    }

    function toRow() {
        $row = parent::toRow();
        // ... Add your fields to the row.
        return $row;
    }

    function fromRow($row) {
        parent::fromRow($row);
        // ... Set your fields.
    }
}
```

Saving is extremely simple when you have an object whose class extends row.

`$object->save();`

### MyDB

[](#mydb)

Your connection to mysql. To get your rows as objects use this singleton `MyDB::getInstance()`

**getObjectByID(Class::class,$id)**

Alternatively you can just call `getByID($id)` on your custom Row object.

This will return your exact object.

**getObjectsWithQuery(Class::class,$query)**

An array of objects based on a custom query. Not all queries need to be written out though.

**getObjectByColumn(Class::class, 'ColumnName', $value)**

If you're only searching by one column use this simple function.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Recently: every ~26 days

Total

6

Last Release

3625d ago

### Community

Maintainers

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

---

Top Contributors

[![wcatron](https://avatars.githubusercontent.com/u/5385284?v=4)](https://github.com/wcatron "wcatron (1 commits)")

---

Tags

mysqlodmObject Based

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wcatron-mysql-db-framework/health.svg)

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

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[doctrine/persistence

The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.

4.1k286.5M762](/packages/doctrine-persistence)[gedmo/doctrine-extensions

Doctrine behavioral extensions

4.1k118.8M366](/packages/gedmo-doctrine-extensions)[dunglas/doctrine-json-odm

An object document mapper for Doctrine ORM using JSON types of modern RDBMS.

6285.0M10](/packages/dunglas-doctrine-json-odm)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k25.2M34](/packages/kirschbaum-development-eloquent-power-joins)[doctrine/mongodb-odm

PHP Doctrine MongoDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to MongoDB.

1.1k23.3M302](/packages/doctrine-mongodb-odm)

PHPackages © 2026

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