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

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

gigorok/php-orm
===============

The open source ORM library

0.2.3(12y ago)056MITPHPPHP &gt;=5.4

Since Jan 30Pushed 11y ago1 watchersCompare

[ Source](https://github.com/gigorok/php-orm)[ Packagist](https://packagist.org/packages/gigorok/php-orm)[ Docs](http://github.com/gigorok/php-orm)[ RSS](/packages/gigorok-php-orm/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (7)Used By (0)

PHP ORM library
===============

[](#php-orm-library)

=============================

The open source ORM library on PHP.

Introduction
------------

[](#introduction)

The PHP-ORM follows ActiveRecord architectural pattern.

More details can be found [here](http://en.wikipedia.org/wiki/Active_record_pattern).

Minimum Requirements
--------------------

[](#minimum-requirements)

- PHP 5.4+
- PDO driver for your respective database

Supported Databases
-------------------

[](#supported-databases)

- MySQL
- PostgreSQL

Features
--------

[](#features)

- Finder methods
- Writer methods
- Relationships
- Validations
- Callbacks
- Transactions
- Support for multiple adapters
- Table's schema

Installation
------------

[](#installation)

Use [composer](http://getcomposer.org) to install PHP ORM library. Just add to your `composer.json` a text below and run the `php composer.phar update` command to install it:

```
{
    "require": {
        "gigorok/php-orm": "0.2.*"
    }
}

```

Basic CRUD
----------

[](#basic-crud)

### Retrieve

[](#retrieve)

These are your basic methods to find and retrieve records from your database.

```
$post = Post::find(1);
echo $post->title; # 'Test title!'
echo $post->author_id; # 5

# also the same since it is the first record in the db
$post = Post::first();

# finding using a conditions array
$posts = Post::where('name=? or id > ?', array('The Bridge Builder', 100));

```

### Create

[](#create)

Here we create a new post by instantiating a new object and then invoking the save() method.

```
$post = new Post();
$post->title = 'My first blog post!!';
$post->author_id = 5;
$post->save();
# INSERT INTO `posts` (title,author_id) VALUES('My first blog post!!', 5)

```

### Update

[](#update)

To update you would just need to find a record first and then change one of its attributes.

```
$post = Post::find(1);
echo $post->title; # 'My first blog post!!'
$post->title = 'Some real title';
$post->save();
# UPDATE `posts` SET title='Some real title' WHERE id=1

$post->title = 'New real title';
$post->author_id = 1;
$post->save();
# UPDATE `posts` SET title='New real title', author_id=1 WHERE id=1

```

### Destroy

[](#destroy)

Deleting a record will not *destroy* the object. This means that it will call sql to delete the record in your database but you can still use the object if you need to.

```
$post = Post::find(1);
$post->destroy();
# DELETE FROM `posts` WHERE id=1
echo $post->title; # 'New real title'

```

License
-------

[](#license)

Licensed under the MIT license.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.9% 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 ~17 days

Total

6

Last Release

4404d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/648944?v=4)[Igor Gonchar](/maintainers/gigorok)[@gigorok](https://github.com/gigorok)

---

Top Contributors

[![gigorok](https://avatars.githubusercontent.com/u/648944?v=4)](https://github.com/gigorok "gigorok (31 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")

---

Tags

phporm

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[matchory/elasticsearch

The missing elasticsearch ORM for Laravel!

3059.0k](/packages/matchory-elasticsearch)[modul-is/orm

Lightweight hybrid ORM/Explorer

1118.1k](/packages/modul-is-orm)[riverside/php-orm

PHP ORM micro-library and query builder

111.2k](/packages/riverside-php-orm)

PHPackages © 2026

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