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

ActiveLibrary

iamjohndev/ijd-orm
==================

A simple and lightweight PHP ORM for MySQLi

1.1.4.7(2y ago)6271[1 PRs](https://github.com/PseudoDevs/IamJohnDevORM/pulls)MITPHPPHP ^8.0

Since May 11Pushed 2y ago1 watchersCompare

[ Source](https://github.com/PseudoDevs/IamJohnDevORM)[ Packagist](https://packagist.org/packages/iamjohndev/ijd-orm)[ RSS](/packages/iamjohndev-ijd-orm/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (9)Used By (0)

IJDORM
======

[](#ijdorm)

**IJDORM** is a lightweight and easy-to-use ORM (Object-Relational Mapping) library for PHP that provides a convenient way to interact with your MySQL database. With **IJDORM**, you can perform common **CRUD** (Create, Read, Update, Delete) operations on your database without having to write complex SQL queries.

### Features

[](#features)

- Execute custom queries
- Retrieve all rows from a table
- Retrieve the first row from a table
- Retrieve the last row from a table
- Select specific columns from a table
- Filter rows based on conditions
- Insert new rows into a table
- Update existing rows in a table
- Delete rows from a table
- Join tables based on specified conditions

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

[](#requirements)

- PHP 8.0 or higher
- MySQL database

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

[](#installation)

IJDORM can be installed via Composer, the dependency management tool for PHP. Run the following command in your project directory to add IJDORM as a dependency:

`composer require iamjohndev/ijd-orm`

After the installation, you can include the Composer autoloader in your PHP scripts to autoload the IJDORM classes:

`require_once 'vendor/autoload.php';`

Usage
-----

[](#usage)

### Creating an Instance

[](#creating-an-instance)

To start using IJDORM, create an instance of the IJDORM class by providing the table name and a database connection object (an instance of mysqli):

```
use iamjohndev\IJDORM;

// Create a database connection
$connection = new mysqli('localhost', 'username', 'password', 'database');

// Create an instance of IJDORM
$dorm = new IJDORM($connection, 'users');
```

Retrieving Data
===============

[](#retrieving-data)

**Find a Record**To retrieve a single record from the database by its ID, use the find method:

```
$user = $dorm->find(1);
```

This will return an object representing the retrieved record.

Retrieve All Records
====================

[](#retrieve-all-records)

To retrieve all records from the table, use the **all()** method:

```
$users = $dorm->all();
```

This will return an array of associative arrays, where each array represents a record.

Custom Queries
==============

[](#custom-queries)

If you need to execute custom queries, you can use the **get()** method:

```
$query = "SELECT * FROM users WHERE age > ?";
$users = $dorm->get($query, [18]);
```

This will return an array of associative arrays, where each array represents a record that matches the query.

Creating Records
================

[](#creating-records)

To create a new record in the database, use the **create()** method:

```
$data = [
    'name' => 'John Doe',
    'email' => 'john@example.com',
];

$result = $dorm->create($data);

if ($result['success']) {
    echo 'Record created successfully';
} else {
    echo 'Failed to create record: ' . $result['errors'];
}
```

Creating Records with Rules
===========================

[](#creating-records-with-rules)

To create a new record in the database, use the **create()** method:

```
$rules = [
    'author_name' => 'required|min:3|max:255|unique:authors,author_name',
];
$createAuthor = $orm->create([
    'author_name' => $request->author_name,
], $rules);

if ($createAuthor['success']) {
    echo "Author created successfully";
} else {
    foreach ($createAuthor['errors'] as $field => $errors) {
        foreach ($errors as $error) {
            $_SESSION['errors'][$field][] = $error;
        }
    }
}
```

The **create** method takes an associative array representing the data to be inserted. You can also provide validation rules to validate the data before insertion.

Updating Records
================

[](#updating-records)

To update an existing record in the database, use the **update()** method:

```
$id = 1;
$data = [
    'name' => 'Jane Doe',
    'email' => 'jane@example.com',
];

$id = 1;
$data = array(
    'name' => 'Jane Doe',
    'email' => 'jane@example.com',
);

$result = $dorm->update($id, $data);

if ($result['success']) {
    echo 'Record updated successfully';
} else {
    echo 'Failed to update record: ' . $result['errors'];
}
```

The **update** method takes the ID of the record to be updated and an associative array representing the updated data. Like the create method, you can provide validation rules to validate the data before updating.

Deleting Records
================

[](#deleting-records)

To delete a record from the database, use the **delete()** method:

```
$id = 1;

$result = $dorm->delete($id);

if ($result['success']) {
    echo 'Record deleted successfully';
} else {
    echo 'Failed to delete record: ' . $result['errors'];
}
```

The **delete** method takes the ID of the record to be deleted.

Chaining Methods
================

[](#chaining-methods)

You can chain multiple methods together to build complex queries:

```
$users = $dorm->where('age', '>', 18)
              ->orderBy('name', 'asc')
              ->limit(10)
              ->get();

foreach ($users as $user) {
    echo $user['name'] . ' - ' . $user['email'] . '';
}
```

In this example, we are using method chaining to build a query. We start by using the **where** method to specify a condition (age &gt; 18). Then, we use the **orderBy** method to sort the results by name in ascending order. Next, we use the limit method to limit the number of records to retrieve (in this case, 10). Finally, we call the **get** method to execute the query and retrieve the results.

The retrieved records are then iterated over in a foreach loop, and the name and email of each user are echoed.

### Contributions

[](#contributions)

Contributions to IJDORM are welcome! If you find any issues or have suggestions for improvements, please create an issue or submit a pull request on the [GitHub repository.](https://github.com/IamJohnDev/IJDORM "GitHub repository.")

### License

[](#license)

**IJDORM** is open-source software licensed under the MIT License. See the [LICENSE](https://github.com/PseudoDevs/IamJohnDevORM/blob/main/LICENSE.txt "LICENSE") file for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92% 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 ~4 days

Total

8

Last Release

1066d ago

### Community

Maintainers

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

---

Top Contributors

[![PseudoDevs](https://avatars.githubusercontent.com/u/28098260?v=4)](https://github.com/PseudoDevs "PseudoDevs (46 commits)")[![EliteDevsPH](https://avatars.githubusercontent.com/u/63099220?v=4)](https://github.com/EliteDevsPH "EliteDevsPH (3 commits)")[![lancekenji](https://avatars.githubusercontent.com/u/88411779?v=4)](https://github.com/lancekenji "lancekenji (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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