PHPackages                             andela-cnnadi/micro-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. andela-cnnadi/micro-orm

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

andela-cnnadi/micro-orm
=======================

Simple PHP ORM Solution

411PHP

Since Jul 12Pushed 10y ago3 watchersCompare

[ Source](https://github.com/andela-cnnadi/MicroORM)[ Packagist](https://packagist.org/packages/andela-cnnadi/micro-orm)[ RSS](/packages/andela-cnnadi-micro-orm/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

\#Cashew - Micro ORM Lightweight PHP ORM Solution. Supports only MySQL for now.

\###Installation Run the following command within the root folder of your application

```
composer require "andela-cnnadi/micro-orm": "dev-master"

```

Or you can just add the package name "andela-cnnadi/micro-orm": "dev-master" as a dependency within your composer.json file.

\###Getting Started To get started you need to configure your database connection. This can be done within the `config` folder in the package directory. There's a file called `config.php` which you can fill out with your database configuration information.

\###Start Creating Models To create a model you need to create a new class that extends the Cashew class. Each separate model should extend this class. Recommended file structure is shown below. See example for more details. By Default, Cashew Micro-ORM makes use of plural conventions for table names.

```

```

```

```

```
-app
  - vendor
    - micro-orm
  - models
    - User.php
    - Phone.php
  - index.php

```

Models can then be required within the application as shown below

```
require 'vendor/autoload.php';
require 'models/User.php';
require 'models/Phone.php';
```

\###Model Configuration options The `$model` variable within the Model class is used to store the field configuration of the model you are creating. It contains the field names as keys and field configurations as value. The field configuration contains key-value pairs of the various configuration options against the required values. The available configuration options include

- `type` - Type of the field. Available options include int, text, varchar, smallint
- `null` - (optional) True or False value indicating whether the field can be null or not respectively. Defaults to true if nothing is specified
- `size` - Supports fields like varchar, int. Used to specify the maximum length of the field.

An example of a Model using the configuration options is shown below:

```

```

\####Model Methods

- `get` - Fetches the result from a table based on an id. Example is shown below:

```
  // $id must be a number
  $user = User::get($id);
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.3% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a49905556104f04c41923c0b89acf5585486fcadfdfbc8491db1025b0ead31a4?d=identicon)[andela-cnnadi](/maintainers/andela-cnnadi)

---

Top Contributors

[![unicodeveloper](https://avatars.githubusercontent.com/u/2946769?v=4)](https://github.com/unicodeveloper "unicodeveloper (9 commits)")[![afropolymath](https://avatars.githubusercontent.com/u/3100850?v=4)](https://github.com/afropolymath "afropolymath (7 commits)")

### Embed Badge

![Health badge](/badges/andela-cnnadi-micro-orm/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8361.6M87](/packages/propel-propel1)[mpociot/laravel-composite-key

Support composite keys in your laravel app.

3544.8k1](/packages/mpociot-laravel-composite-key)

PHPackages © 2026

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