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

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

sandeshshrestha/tiny-orm
========================

Tiny ORM to map between objects and database queries

1.4(4y ago)122MITPHP

Since Nov 4Pushed 4y ago2 watchersCompare

[ Source](https://github.com/sandeshshrestha/PHP-Tiny-ORM)[ Packagist](https://packagist.org/packages/sandeshshrestha/tiny-orm)[ Docs](https://sandeshshrestha.github.io/PHP-Tiny-ORM/)[ RSS](/packages/sandeshshrestha-tiny-orm/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (5)DependenciesVersions (5)Used By (0)

PHP Tiny ORM
============

[](#php-tiny-orm)

### Installation

[](#installation)

```
composer require sandeshshrestha/tiny-orm
```

### Configuration

[](#configuration)

Define few constants.

```
// Define __FILE_STORAGE_PATH__ constant where the FileStorage::save() method saves the file.
define("__FILE_STORAGE_PATH__", __DIR__ . '/uploaded_files/');
// Define __DATABASE_CONFIG__ constant that will be used by Database.php to connect to database
define("__DATABASE_CONFIG__", [
    'type' => 'mysql',
    'host' => 'mysql.example.com',
    'username' => 'db_username',
    'password' => 'db_password',
    'database' => 'db_name',
    'table_prefix' => 'db_table_prefix',
    'port' => 3306
  ]);
```

### Database

[](#database)

Create database tables

```
CREATE TABLE `db_table_prefix_user` (
  `id` varchar(255) NOT NULL,
  `fullName` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
```

### Usage

[](#usage)

```
use TinyORM\Model;

class User extends Model {
  protected $table = 'user';
  protected $primaryKey = 'id';
  protected $fillable = ["fullName", "email"];
}

$user = new User();
$user->fullName = "John Doe";
$user->email = "johndoe@example.com";
$user->save();

$user2 = User::create([
  'fullName' => "John Doe 2",
  "email" => "johndoe2@example.com",
]);

$foundUser = User::find($user->getPrimaryValue());

$foundUser->delete();

$users = User::where("fullName", "John Doe")->limit(1)->orderBy('id')->exec();
```

### Documentations

[](#documentations)

### Code quality status

[](#code-quality-status)

[![SonarCloud](https://camo.githubusercontent.com/6c4c5f2b880ecf74ee24fb0d5b4f98e3aa482239167d2834cba1a40e2e60d74c/68747470733a2f2f736f6e6172636c6f75642e696f2f696d616765732f70726f6a6563745f6261646765732f736f6e6172636c6f75642d77686974652e737667)](https://sonarcloud.io/summary/new_code?id=sandeshshrestha_PHP-Tiny-ORM)

[![Quality Gate Status](https://camo.githubusercontent.com/2357671df7e23064af2d78674505281b1b235fc306bb43b2380f079797096f26/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d73616e6465736873687265737468615f5048502d54696e792d4f524d266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/summary/new_code?id=sandeshshrestha_PHP-Tiny-ORM)[![Bugs](https://camo.githubusercontent.com/0d382a161152ab38ba55f67fb0a2418c42f9d09b4088ed9fa2f62aefa991931f/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d73616e6465736873687265737468615f5048502d54696e792d4f524d266d65747269633d62756773)](https://sonarcloud.io/summary/new_code?id=sandeshshrestha_PHP-Tiny-ORM)[![Code Smells](https://camo.githubusercontent.com/37dfc65c4f17af6540e929e56bfaa663c812ae491e394367d2e34a18d8c068d3/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d73616e6465736873687265737468615f5048502d54696e792d4f524d266d65747269633d636f64655f736d656c6c73)](https://sonarcloud.io/summary/new_code?id=sandeshshrestha_PHP-Tiny-ORM)[![Vulnerabilities](https://camo.githubusercontent.com/27aba5fb14c5ae740ac5d5bd445071eaae7af5629f833e88422701563fc42163/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d73616e6465736873687265737468615f5048502d54696e792d4f524d266d65747269633d76756c6e65726162696c6974696573)](https://sonarcloud.io/summary/new_code?id=sandeshshrestha_PHP-Tiny-ORM)[![Security Rating](https://camo.githubusercontent.com/5ebf09b449d34e48ef62f487142e40d19c7dfdc34a2d12d335fd215c2ccf4c96/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d73616e6465736873687265737468615f5048502d54696e792d4f524d266d65747269633d73656375726974795f726174696e67)](https://sonarcloud.io/summary/new_code?id=sandeshshrestha_PHP-Tiny-ORM)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

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 ~260 days

Total

4

Last Release

1602d ago

### Community

Maintainers

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

---

Top Contributors

[![sandeshshrestha](https://avatars.githubusercontent.com/u/12611800?v=4)](https://github.com/sandeshshrestha "sandeshshrestha (24 commits)")

---

Tags

lightweightormphpphporm

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/sandeshshrestha-tiny-orm/health.svg)](https://phpackages.com/packages/sandeshshrestha-tiny-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)
