PHPackages                             mappeador/mappeador - 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. mappeador/mappeador

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

mappeador/mappeador
===================

Mappeador is a simple, flexible and easy way to perform php crud with MYSQL.

v1.5(10y ago)019MITPHPPHP &gt;=5.3.0

Since Sep 22Pushed 10y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (6)Used By (0)

\#Mappeador by Anthony Gonzalez

Mappeador is a simple, flexible and easy way to perform php crud with MYSQL.

Configuration
=============

[](#configuration)

Go to config.php file:

```
defined('DB_SERVER') ? null : define("DB_SERVER", "your_host");
defined('DB_USER')   ? null : define("DB_USER", "your_username");
defined('DB_PASS')   ? null : define("DB_PASS", "your_password");
defined('DB_NAME')   ? null : define("DB_NAME", "db_name");
```

Usage
=====

[](#usage)

First you need to configure the initialize file depending on your file structure and require the file. Once the database and the table is created you have to create class that inherits from Mapper, and create public variables for each table field.

Example create and table called users with 2 fields id and name, then create the following class:

```
use mappeador\Mapper;

class User extends Mapper {

  protected static $table_name="users";

  public $id;
	public $name;

}
```

Save function it will return true if saved:

```
$john = new User();
$john->name = "John";
$john->save(); /* or */ $john->create();
```

Save function at instantiation with array params:

```
$john = new User(array( 'name' => 'John' ));
$john->save(); /* or */ $john->create();
```

Find all function returns an object array:

```
$users = User::find_all();
foreach($users as $user){
    echo $user->id . " | " . $user->name;
}
```

To find order by you just have to pass a parameter to find\_all(). Example:

```
$users = User::find_all("id DESC");
```

Find by id (the parameter has to be an integer):

```
$user = User::find_by_id(1);
echo $user->name;
```

Find where (will return one object if LIMIT 1):

```
$find_johns = User::find_where( "name = ?", array("John") );
$find_john = User::find_where( "name = ? LIMIT 1", array('John') );
```

Count all:

```
User::count_all();
```

Update(first you need to find a record, it will return true if updated):

```
$user = User::find_by_id(1);
$user->name = "John";
$user->update(); /* or */ $john->save();
```

Delete(you need to find record first also, and returns true if deleted):

```
$user = User::find_by_id(1);
$user->name = "John";
$user->delete();
```

\[Note: after deleted it will still be in the object, it will only be deleted from database.\]

Find by sql can be use directly with DatabaseObject class, Mapper or class that inherits from Mapper. If the sql doesn't need sanitazation just pass one parameter with sql otherwise pass 2 parameter the sql and an array with the bind params.

Example that doesn't need sanitazation(returns object array):

```
use mappeador\DatabaseObject;

$sql = "SELECT * FROM users";
$result_set = DatabaseObject::find_by_sql($sql);
```

Example that needs sanitazation:

```
use mappeador\DatabaseObject;

$param = array(1);
$sql = "SELECT * FROM users WHERE id=? LIMIT 1";
$result_set = DatabaseObject::find_by_sql($sql, $param);
```

Mysql query:

```
use mappeador\MySQLDatabase;

$db = MySQLDatabase::getInstance();

$db->query($sql);
```

\[Dangerous: don't use if you need sanitazation.\]

Close connection:

```
use mappeador\MySQLDatabase;

$db = MySQLDatabase::getInstance();
if( isset($db) ) { $db->close_connection(); }
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

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

Every ~2 days

Total

5

Last Release

3919d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/047dbf836852a5ea59e7306a9c1e2b412540997ee38c204f4f10006684116e54?d=identicon)[darkdevilish](/maintainers/darkdevilish)

---

Top Contributors

[![darkdevilish](https://avatars.githubusercontent.com/u/3498488?v=4)](https://github.com/darkdevilish "darkdevilish (71 commits)")

---

Tags

ormmappeador

### Embed Badge

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

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k295.3M7.2k](/packages/doctrine-orm)[doctrine/doctrine-bundle

Symfony DoctrineBundle

4.8k249.9M3.9k](/packages/doctrine-doctrine-bundle)[doctrine/persistence

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

4.0k298.2M962](/packages/doctrine-persistence)[gedmo/doctrine-extensions

Doctrine behavioral extensions

4.1k122.6M410](/packages/gedmo-doctrine-extensions)[illuminate/database

The Illuminate Database package.

2.8k54.1M11.1k](/packages/illuminate-database)[beberlei/doctrineextensions

A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.

2.1k78.1M168](/packages/beberlei-doctrineextensions)

PHPackages © 2026

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