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

ActiveLibrary

ibonly/potato-orm
=================

1.1(10y ago)22041[1 PRs](https://github.com/andela-iadeniyi/Potato-ORM/pulls)PHPPHP &gt;=5.5

Since Mar 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/andela-iadeniyi/Potato-ORM)[ Packagist](https://packagist.org/packages/ibonly/potato-orm)[ RSS](/packages/ibonly-potato-orm/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (4)Versions (12)Used By (0)

ƒ# Potato-ORM

[![Build Status](https://camo.githubusercontent.com/7d2d7a54df6445649765009a03760b3b658d1e34a5093439442037ad39d72302/68747470733a2f2f7472617669732d63692e6f72672f616e64656c612d696164656e6979692f506f7461746f2d4f524d2e737667)](https://travis-ci.org/andela-iadeniyi/Potato-ORM)[![License](https://camo.githubusercontent.com/e498eead712d82d9ee1af0a4850acd2e46ea48c48fb9ce5a3d2ab64f28f95b34/687474703a2f2f696d672e736869656c64732e696f2f3a6c6963656e73652d6d69742d626c75652e737667)](https://github.com/andela-iadeniyi/Potato-ORM/blob/master/LICENCE)[![Quality Score](https://camo.githubusercontent.com/8c775c29e572e88a5e8a29571569d8ce72a576079b10d730b002f1003f4b2f62/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f616e64656c612d696164656e6979692f506f7461746f2d4f524d2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/andela-iadeniyi/Potato-ORM)[![Scruitinizer Code](https://camo.githubusercontent.com/ffdedecc605ed2fbfffd74e9cbb7df59fd923a6479f422bc9e71e983f05869f5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616e64656c612d696164656e6979692f506f7461746f2d4f524d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/andela-iadeniyi/Potato-ORM)[![Code Climate](https://camo.githubusercontent.com/852525df04f1ce019f0a413c4c7a1c7dcfe047fa1bc0debc46a43192f2340d1b/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f616e64656c612d696164656e6979692f506f7461746f2d4f524d2f6261646765732f6770612e737667)](https://codeclimate.com/github/andela-iadeniyi/Potato-ORM)[![Test Coverage](https://camo.githubusercontent.com/528b87303d7a0bf8b6cec640c531dee93a5b1d90c6bdeaab7f547e91fd27d05a/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f616e64656c612d696164656e6979692f506f7461746f2d4f524d2f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/andela-iadeniyi/Potato-ORM/coverage)

Potato-ORM is a package that manages the CRUD operation of database. Potato-ORM currently supports `MYSQL`, `POSTGRES` and `SQLITE` Database.

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

[](#installation)

[PHP](https://php.net) 5.5+ and [Composer](https://getcomposer.org) are required.

Via Composer

```
$ composer require ibonly/potato-orm

```

```
$ composer install

```

Usage
-----

[](#usage)

### App Namespace

[](#app-namespace)

```
    namespace Ibonly\PotatoORM

```

Create a `Class` that correspond to the singular form of the table name in the database. i.e.

```
    namespace Ibonly\PotatoORM;

    class User extends Model
    {
        protected $table = 'tableName';

        protected fillables = ['name', 'email'];
    }
```

The table name can also be defined in the model if the user wants it to be specified.

The fields that is to be output can also be specified as `protected $fillables = []`.

The `Model` class contains `getAll()`, `where([$field => $value])`, `find($value)`, `save()`, update() and `detroy($id)` methods.

### getAll()

[](#getall)

```
    use Ibonly\PotatoORM\User;

    $sugar = new User();

    return $sugar->getAll()->all();
```

```
Return type = JSON

```

### where($field, $value)

[](#wherefield-value)

```
    use Ibonly\PotatoORM\User;

    $sugar = new User();

    return $sugar->where([$field => $value])->first()->username;
```

Passing conditions to where

```
    return $sugar->where([$field => $value, $field2 => $value2], 'AND')->first()->username;
```

```
Return type = String

```

### Update($value):

[](#updatevalue)

```
    use Ibonly\PotatoORM\User;
    $update = new User();

    $update->password = "password";
    echo $insert->update(1)
```

```
To return custom message, wrap the `save()` method in an `if statement`

Return type = Boolean

```

### save()

[](#save)

```
    use Ibonly\PotatoORM\User;

    $insert = new User();
    $insert->id = NULL;
    $insert->username = "username";
    $insert->email = "example@example.com";
    $insert->password = "password";
    echo $insert->save();
```

```
To return custom message, wrap the `save()` method in an `if statement`

Return type = Boolean

```

### file($fileName)-&gt;uploadFile()

[](#filefilename-uploadfile)

This method is used to upload file, it can only be used along side `save()` and `update($id)`

```
    use Ibonly\PotatoORM\User;

    $insert = new User();
    $insert->id = NULL;
    $insert->username = "username";
    $insert->email = "example@example.com";
    $insert->avatar = $this->content->file($_FILES['image'])->uploadFile($uploadDirectory);
    $insert->password = "password";
    echo $insert->save();
```

### detroy($value)

[](#detroyvalue)

```
    use Ibonly\PotatoORM\User;

    $insert = User::destroy(2);
    die($insert);
```

```
Return type = Boolean

```

Create Database Table
---------------------

[](#create-database-table)

Its is also possible to create Database Table with the `Schema` class. The table name will be specified in the `createTable($name)` method.

```
    use Ibonly\PotatoORM\Schema;

    $user = new Schema;
    $user->field('increments', 'id');
    $user->field('strings', 'username');
    $user->field('strings', 'name', 50);
    $user->field('integer', 'age');
    $user->field('primaryKey', 'id');

    echo $table->createTable('players');
```

```
Return type = Boolean

```

#### Database Constraint

[](#database-constraint)

Foreign Key

```
    $user->field('foreignKey', 'id', 'users-id');
```

The reference table `(users)` and field `(id)` will be written as `(users-id)`

Unique Key

```
    $user->field('unique', 'email')
```

Testing
-------

[](#testing)

```
$ vendor/bin/phpunit test

```

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

[](#contributing)

To contribute and extend the scope of this package, Please check out [CONTRIBUTING](CONTRIBUTING.md) file for detailed contribution guidelines.

Credits
-------

[](#credits)

Potato-ORM is created and maintained by `Ibraheem ADENIYI`.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

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

Total

9

Last Release

3668d ago

### Community

Maintainers

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

---

Top Contributors

[![ibonly](https://avatars.githubusercontent.com/u/7251019?v=4)](https://github.com/ibonly "ibonly (118 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[bacula-web/bacula-web

The open source web based reporting and monitoring tool for Bacula

1537.5k](/packages/bacula-web-bacula-web)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[doppar/framework

The Doppar Framework

366.7k8](/packages/doppar-framework)[hardcastle/xrpl_php

PHP SDK / Client for the XRP Ledger

129.7k5](/packages/hardcastle-xrpl-php)

PHPackages © 2026

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