PHPackages                             wallrio/methoddb - 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. wallrio/methoddb

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

wallrio/methoddb
================

ORM using method

v1.0(8y ago)016MITPHP

Since Jul 22Pushed 8y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

MethodDB
========

[](#methoddb)

ORM using method

Create the object
-----------------

[](#create-the-object)

```
$methodDB = new MethodDB();

```

Setup the base
--------------

[](#setup-the-base)

### with MySQL

[](#with-mysql)

```
$methodDB->config(array(
	'driver'=>'mysql',
	'host'=>'host',
	'username'=>'username',
	'password'=>'password',
	'base'=>'base_name'
));

```

### with DJDB

[](#with-djdb)

```
$methodDB->config(array(
    'driver'=>'djdb',
    'host'=> __DIR__,
    'base'=>'base_name'
));

```

#### Detail:

[](#detail)

```
- host: directory to record the data
- base: sub-directory of 'host' to base

```

Connect with the database
-------------------------

[](#connect-with-the-database)

```
$database = $methodDB->connect();

```

Check the entities
------------------

[](#check-the-entities)

```
$tablesArray =  $database->entities();

```

Request data of a table (SELECT)
--------------------------------

[](#request-data-of-a-table-select)

```
$array = $database->TABLE_NAME();

    example:
        $array = $database->users();

```

Request data of a table with filter (SELECT)
--------------------------------------------

[](#request-data-of-a-table-with-filter-select)

```
$array = $database->users(array(
    'where'=>' name LIKE "%user_name%" ',
    'order'=>'ASC',
    'limit'=>'0,2'
));

```

Insert a register to table (INSERT)
-----------------------------------

[](#insert-a-register-to-table-insert)

```
$users = $database->entities('users')->insert();

$users->name = "user name";
$users->login = "username@domain.com";
$users->password = "123456";

$database->save();

```

Insert multiple register to multiple table (INSERT)
---------------------------------------------------

[](#insert-multiple-register-to-multiple-table-insert)

```
$users = $database->entities('users')->insert();

$users->name = "user name";
$users->login = "username@domain.com";
$users->password = "123456";

$users = $database->entities('company')->insert();

$users->name = "Company name";
$users->login = "company@domain.com";

$database->save();

```

Delete a register from table (DELETE)
-------------------------------------

[](#delete-a-register-from-table-delete)

```
$admin = $database->entities('users')->delete(array(
    'where'=>'id = 0123'
));

```

Update a register (UPDATE)
--------------------------

[](#update-a-register-update)

```
$admin = $database->entities('users')->update(array(
    'where'=>'id = 0123'
));

$admin->name = "user name";
$admin->login = "username@domain.com";
$admin->password = "123";

$database->save();

```

To create a new driver
----------------------

[](#to-create-a-new-driver)

```
To create a new driver, you must follow the interface below.

interface MethodDBDRIVERS{

/**
 * connect with the database and define the parameters initial
 * @param  array  $config   Contains the definitions of '$methodDB->config' method
 * @return null
 */
public function connect(array $config);

/**
 * select a or multiples register of entitie
 * @param  [string]     $tableName      Name of entitie
 * @param  array        $parameters     Filter to selection
 * @return array                        list of registers founds
 *
 * @example-return: (object) array(
 *                          "USER_ID"=> (object) array(
 *                              "username"=>"fulano",
 *                              "name"=>"Fulano da Silva",
 *                              "password"=>"123"
 *                          )
 *                      );
 *
 */
public function select($tableName, $parameters);

/**
 * insert a register on database
 * @param  string   $tableName      name of entitie
 * @param  array    $parameters     data of register to save on database
 * @return boolean                  status on save
 */
public function insert($tableName, $parameters);

/**
 * updata a register
 * @param  string   $tableName      name of entitie
 * @param  array    $parameters     filter the register to update
 * @return boolean                  status on save
 */
public function update($tableName, $parameters);

/**
 * [delete description]
 * @param  string   $tableName      name of entitie
 * @param  array    $parameters     filter the register to update
 * @return boolean                  status on save
 */
public function delete($tableName, $parameters);

/**
 * get list the entities
 * @return [array]
 *
 * @example-return: array("user","administrators","logs");
 *
 */
public function tables();

```

}

Example to call driver:
=======================

[](#example-to-call-driver)

```
$methodDB = new MethodDB();
$methodDB->config(array(
    'driver'=> new MyNewDrive(),
    'host'=>'host',
    'username'=>'username',
    'password'=>'password',
    'base'=>'base_name'
))

```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Unknown

Total

1

Last Release

3265d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8528598?v=4)[Wallace Rio](/maintainers/wallrio)[@wallrio](https://github.com/wallrio)

---

Top Contributors

[![wallrio](https://avatars.githubusercontent.com/u/8528598?v=4)](https://github.com/wallrio "wallrio (10 commits)")

### Embed Badge

![Health badge](/badges/wallrio-methoddb/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8441.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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