PHPackages                             arojunior/php-orm-pdo - 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. arojunior/php-orm-pdo

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

arojunior/php-orm-pdo
=====================

Micro PHP ORM Library

1.1(9y ago)192065[4 issues](https://github.com/arojunior/php-orm-pdo/issues)MITPHPPHP &gt;=5.6.0

Since Nov 10Pushed 7y ago7 watchersCompare

[ Source](https://github.com/arojunior/php-orm-pdo)[ Packagist](https://packagist.org/packages/arojunior/php-orm-pdo)[ RSS](/packages/arojunior-php-orm-pdo/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)DependenciesVersions (3)Used By (0)

### Installing via composer and using as a lib

[](#installing-via-composer-and-using-as-a-lib)

```
composer require arojunior/php-orm-pdo
```

### create a file to overwrite the database config

[](#create-a-file-to-overwrite-the-database-config)

```
use SimpleORM\core\model\Model;

class AppModel extends Model
{
    public $db_config = [
        'db_host' => '192.168.1.1',
        'db_name' => 'test',
        'db_user' => 'root',
        'db_pass' => ''
    ];
}
```

#### And then you can extend this class in your classes

[](#and-then-you-can-extend-this-class-in-your-classes)

```
use YourNamespace\AppModel;

class Example extends AppModel
{
    public $table = 't_user';
    public $pk    = 'user_id';

    public function getAll()
    {
        return $this->findAll();
    }
}
```

### CRUD

[](#crud)

```
namespace SimpleORM\app\model;

use SimpleORM\core\model\Model;

class Users extends Model
{
    	/*
        * * Basic configuration
        * These arguments are optionals
        * protected $table = 'users'; //just if the class name a table name are different
        * protected $pk = 'id'; //just if the primary key name is not id
      */
}
```

### Creating a new user (without check)

[](#creating-a-new-user-without-check)

```
$this->Users->create([
  'name' => 'Junior Oliveira',
  'email' => 'arojunior@gmail.com'
]);
```

**Let the ORM choose if it will be created or updated. The ORM will execute the find method before to decide if will create or update data**

### Saving data

[](#saving-data)

```
$this->Users->save([
  'id' => 1,
  'name' => 'Junior Oliveira'
]);
```

### Retrieving the id

[](#retrieving-the-id)

```
$this->Users->lastSavedId();
```

### Updating a user with id = 1

[](#updating-a-user-with-id--1)

```
$this->Users->update([
  'id' => 1,
  'email' => 'contato@arojunior.com'
]);
```

### Delete

[](#delete)

```
$this->Users->delete(['id' => 1]);
```

Read
----

[](#read)

```
$this->Users->findAll(); // fetchAll

$this->Users->findOne(['email' => 'arojunior@gmail.com']);

$this->Users->findById($id);
```

### Checking

[](#checking)

```
$this->Users->exists($id);
```

in case of true, you cat get the data with:

```
$this->Users->fetch();
```

### Functionalities if used as Framework

[](#functionalities-if-used-as-framework)

- CRUD functions
- Auto load Model classes in Controllers
- To use the automatic functions you should use the filename and structure conventions
- Just follow the example on /controller/UsersController.php
- All controllers in /app/controllers folder
- All models in /app/models folder

### Convetions

[](#convetions)

- All controllers in /app/controller path
- All models in /app/model path
- All views in /app/view path
- Filenames and classes must has the same name

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.6% 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 ~123 days

Total

2

Last Release

3349d ago

PHP version history (2 changes)1.0PHP &gt;=5.4.0

1.1PHP &gt;=5.6.0

### Community

Maintainers

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

---

Top Contributors

[![arojunior](https://avatars.githubusercontent.com/u/7604033?v=4)](https://github.com/arojunior "arojunior (57 commits)")[![bruno-farias](https://avatars.githubusercontent.com/u/5460340?v=4)](https://github.com/bruno-farias "bruno-farias (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

crudormphpphp-orm-pdo

### Embed Badge

![Health badge](/badges/arojunior-php-orm-pdo/health.svg)

```
[![Health](https://phpackages.com/badges/arojunior-php-orm-pdo/health.svg)](https://phpackages.com/packages/arojunior-php-orm-pdo)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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