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

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

initorm/orm
===========

InitORM ORM

1.0(2y ago)0542MITPHPPHP &gt;=8.0

Since Dec 15Pushed 2y agoCompare

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

READMEChangelog (1)Dependencies (1)Versions (3)Used By (2)

InitORM
=======

[](#initorm)

Manage your database with or without abstraction. This library is built on the PHP PDO plugin and is mainly used to build and execute SQL queries.

[![Latest Stable Version](https://camo.githubusercontent.com/49902b7447159a51885bb2f639b75113fd5aab5184d69a1eeb3aefe71885c222/687474703a2f2f706f7365722e707567782e6f72672f696e69746f726d2f6f726d2f76)](https://packagist.org/packages/initorm/orm) [![Total Downloads](https://camo.githubusercontent.com/4d4eb39cea94c250395935dc53cbd2cb2a73ad4b4f64bb85b4d80899413b2b71/687474703a2f2f706f7365722e707567782e6f72672f696e69746f726d2f6f726d2f646f776e6c6f616473)](https://packagist.org/packages/initorm/orm) [![Latest Unstable Version](https://camo.githubusercontent.com/933e93d0d920584123f46200c91206e7fe1c35c888e1a5daf774fe9207f02d7e/687474703a2f2f706f7365722e707567782e6f72672f696e69746f726d2f6f726d2f762f756e737461626c65)](https://packagist.org/packages/initorm/orm) [![License](https://camo.githubusercontent.com/e8ae9e50ec8dd1e35d2e1931d54f58378f1951b7d87a25a1ba735734fc3c55da/687474703a2f2f706f7365722e707567782e6f72672f696e69746f726d2f6f726d2f6c6963656e7365)](https://packagist.org/packages/initorm/orm) [![PHP Version Require](https://camo.githubusercontent.com/b01cdb6ce80cdfbced162f68c0fc0c235974a32983e40b466128cc0f6fa2a203/687474703a2f2f706f7365722e707567782e6f72672f696e69746f726d2f6f726d2f726571756972652f706870)](https://packagist.org/packages/initorm/orm)

Requirements
------------

[](#requirements)

- PHP 8.0 and later.
- PHP PDO extension.

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

[](#supported-databases)

This library should work correctly in almost any database that uses basic SQL syntax. Databases supported by PDO and suitable drivers are available at .

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

[](#installation)

```
composer require initorm/orm

```

Usage
-----

[](#usage)

### Model and Entity

[](#model-and-entity)

Model and Entity; are two common concepts used in database abstraction. To explain these two concepts in the roughest way;

- **Model :** Each model is a class that represents a table in the database.
- **Entity :** Entity is a class that represents a single row of data.

The most basic example of a model class would look like this.

```
namespace App\Model;

class Posts extends \InitORM\ORM\Model
{

    /**
    * If your model will use a connection other than your global connection, provide connection information.
    * @var array|null Default : NULL
    */
    protected array $credentials = [
        'dsn'               => '',
        'username'          => 'root',
        'password'          => '',
        'charset'           => 'utf8mb4',
        'collation'         => 'utf8mb4_unicode_ci',
    ];

    /**
     * If not specified, \InitORM\ORM\Entity::class is used by default.
     *
     * @var string
     */
    protected $entity = \App\Entities\PostEntity::class;

    /**
     * If not specified, the name of your model class is used.
     *
     * @var string
     */
    protected string $schema = 'posts';

    /**
     * The name of the PRIMARY KEY column.
     *
     * @var string
     */
    protected string $schemaId = 'id';

    /**
     * Specify FALSE if you want the data to be permanently deleted.
     *
     * @var bool
     */
    protected bool $useSoftDeletes = true;

    /**
     * Column name to hold the creation time of the data.
     *
     * @var string|null
     */
    protected ?string $createdField = 'created_at';

    /**
     * The column name to hold the last time the data was updated.
     *
     * @var string|null
     */
    protected ?string $updatedField = 'updated_at';

    /**
     * Column name to keep deletion time if $useSoftDeletes is active.
     *
     * @var string|null
     */
    protected ?string $deletedField = 'deleted_at';

    protected bool $readable = true;

    protected bool $writable = true;

    protected bool $deletable = true;

    protected bool $updatable = true;

}
```

The most basic example of a entity class would look like this.

```
namespace App\Entities;

class PostEntity extends \InitORM\ORM\Entity
{
    /**
     * An example of a getter method for the "post_title" column.
     *
     * Usage :
     * echo $entity->post_title;
     */
    public function getPostTitleAttribute($title)
    {
        return strtoupper($title);
    }

    /**
     * An example of a setter method for the "post_title" column.
     *
     * Usage :
     * $entity->post_title = 'New Post Title';
     */
    public function setPostTitleAttribute($title)
    {
        $this->post_title = strtolower($title);
    }

}
```

Getting Help
------------

[](#getting-help)

If you have questions, concerns, bug reports, etc, please file an issue in this repository's Issue Tracker.

Getting Involved
----------------

[](#getting-involved)

> All contributions to this project will be published under the MIT License. By submitting a pull request or filing a bug, issue, or feature request, you are agreeing to comply with this waiver of copyright interest.

There are two primary ways to help:

- Using the issue tracker, and
- Changing the code-base.

### Using the issue tracker

[](#using-the-issue-tracker)

Use the issue tracker to suggest feature requests, report bugs, and ask questions. This is also a great way to connect with the developers of the project as well as others who are interested in this solution.

Use the issue tracker to find ways to contribute. Find a bug or a feature, mention in the issue that you will take on that effort, then follow the Changing the code-base guidance below.

### Changing the code-base

[](#changing-the-code-base)

Generally speaking, you should fork this repository, make changes in your own fork, and then submit a pull request. All new code should have associated unit tests that validate implemented features and the presence or lack of defects. Additionally, the code should follow any stylistic and architectural guidelines prescribed by the project. In the absence of such guidelines, mimic the styles and patterns in the existing code-base.

Credits
-------

[](#credits)

- [Muhammet ŞAFAK](https://www.muhammetsafak.com.tr) &lt;&gt;

License
-------

[](#license)

Copyright © 2023 [MIT License](./LICENSE)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

Total

2

Last Release

869d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b6b34f3ac8938d8ee52ba3bd260680855dc5715c7b2929d9380de30d15a67dd?d=identicon)[muhammetsafak](/maintainers/muhammetsafak)

---

Top Contributors

[![muhammetsafak](https://avatars.githubusercontent.com/u/104234499?v=4)](https://github.com/muhammetsafak "muhammetsafak (3 commits)")

---

Tags

ormpdo-mysqlpdo-postgrespdo-sqlitephp-ormphp-orm-mysqlphp-orm-pdophpdatabaseormpdophp8

### Embed Badge

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

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

###  Alternatives

[druidfi/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

35489.8k6](/packages/druidfi-mysqldump-php)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

845.7k](/packages/tommyknocker-pdo-database-class)[wayofdev/laravel-cycle-orm-adapter

🔥 A Laravel adapter for CycleORM, providing seamless integration of the Cycle DataMapper ORM for advanced database handling and object mapping in PHP applications.

3516.7k3](/packages/wayofdev-laravel-cycle-orm-adapter)[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)
