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

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

faslatam/orm
============

Tiny ORM for simple CRUD operations.

v1.0.0(2y ago)14MITPHP

Since Mar 27Pushed 2y agoCompare

[ Source](https://github.com/fadrian06/orm)[ Packagist](https://packagist.org/packages/faslatam/orm)[ Docs](https://github.com/fadrian06/orm)[ RSS](/packages/faslatam-orm/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (4)Used By (0)

Forestry ORM
============

[](#forestry-orm)

[![Latest Version](https://camo.githubusercontent.com/72a389a73d60222f2af5a8f0b540dc42a2f3f1dcaf07f7a3cde94ed5127dee60/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6661647269616e30362f6f726d2e7376673f7374796c653d666c61742d737175617265)](https://github.com/fadrian06/orm/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/bffefd6005126c4a37f21e59d6a9e25fb0acd8c21bdee615f96ad012cc707063/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6661736c6174616d2f6f726d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/faslatam/orm)

Small ORM for basic CRUD operations.

Install
-------

[](#install)

Via Composer

```
$ composer require faslatam/orm
```

Usage
-----

[](#usage)

### Model

[](#model)

#### Create a model

[](#create-a-model)

Any model extends the class `\Forestry\Orm\BaseModel`.

```
class User extends \Forestry\Orm\BaseModel {
  public static $database = 'example';
  public static $table = 'users';
}
```

> You have to define at least the database and table name.

#### Using the model

[](#using-the-model)

You can define getters and setter for all table fields.

```
$user = new User;
$user->setName('Bob');
$user->save();
```

Getters/setters are not mandatory. You can access the properties directly:

```
$user = new User;
$user->name = 'Bob';
$user->save();
```

> Instead of calling the `save()` method, you can explicitly call `insert()` or `update()`. If you set the primary key on a new model object, you have to use the insert() method.

### Connections

[](#connections)

`\Forestry\Orm\Storage` provides a registry for PDO instances.

#### Set a connection

[](#set-a-connection)

A connection is defined with the `set()` method:

```
\Forestry\Orm\Storage::set('default', [
  'dsn' => 'mysql:host=localhost',
  'user' => 'root',
  'password' => '',
  'option' => [/* any PDO options can be defined here */]
]);
```

A model could use another connection if you configure it:

```
use \Forestry\Orm\Storage;
use \Forestry\Orm\BaseModel;

Storage::set('myOtherConnection', [
  'dsn' => 'mysql:host=127.0.0.1',
  'user' => 'root',
  'password' => ''
]);

class Acme extends BaseModel {
  public static $storage = 'myOtherConnection';
  public static $table = 'acme_table';
}
```

> If you try to set an already defined connection `set()` throws a `LogicException`.

#### Get a defined connection

[](#get-a-defined-connection)

You can also freely use the PDO connection like this:

```
Storage::get('myOtherConnection')->exec('SELECT * FROM example.users');
```

> If you try to get an undefined connection `get()` throws a `OutOfBoundsException`.

#### Close a connection

[](#close-a-connection)

To close a defined connection use the `delete()` method:

```
Storage::delete('myOtherConnection');
```

> If you try to close an undefined connection `delte()` throws a `OutOfBoundsException`.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [daniel-melzer](https://github.com/daniel-melzer)
- [fadrian06](https://github.com/fadrian06)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 81.8% 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 ~3148 days

Total

2

Last Release

922d ago

Major Versions

0.1.0 → v1.0.02023-11-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/37f9864d589abf634aa9a44b9aec1f644adf3104e01812da202ac4c1c860957d?d=identicon)[fadrian06](/maintainers/fadrian06)

---

Top Contributors

[![daniel-melzer](https://avatars.githubusercontent.com/u/389719?v=4)](https://github.com/daniel-melzer "daniel-melzer (9 commits)")[![fadrian06](https://avatars.githubusercontent.com/u/109766973?v=4)](https://github.com/fadrian06 "fadrian06 (2 commits)")

---

Tags

databaseormpdoforestry

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[bephp/activerecord

micro activerecord library in PHP(only 400 lines with comments), support chain calls and relations(HAS\_ONE, HAS\_MANY, BELONGS\_TO).

1202.1k2](/packages/bephp-activerecord)[flightphp/active-record

Micro Active Record library in PHP, support chain calls, events, and relations.

163.0k](/packages/flightphp-active-record)

PHPackages © 2026

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