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

ActiveLibrary

demola/potato-orm
=================

A package that perform basic CRUD (create, read, update and delete) operations in your Database.

10PHP

Since Jul 23Pushed 7y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

**Potato ORM**
==============

[](#potato-orm)

[![Coverage Status](https://camo.githubusercontent.com/a12d80308d9d566387b1803344b5aa71df1a391cb8f9f520b0c2c537a7b43cdf/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f616e64656c612d617261696d692f706f7461746f2d6f726d2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/andela-araimi/potato-orm?branch=master) [![Build Status](https://camo.githubusercontent.com/4e1b38f2fc1f531fb63295a7c52aa53f62867de4d465ee7750cae78e0f3f2d00/68747470733a2f2f7472617669732d63692e6f72672f616e64656c612d617261696d692f706f7461746f2d6f726d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/andela-araimi/potato-orm) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/0092679557c67c7e81a2567cf211286441f98ae77b8ce782b011c309d1c83dc2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616e64656c612d617261696d692f706f7461746f2d6f726d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/andela-araimi/potato-orm/?branch=master)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#--)

Potato-ORM is based on concepts borrowed from the Laravel framework. It is a package that can perform the basic CRUD (create, read, update and delete) operations.

**Installation**
----------------

[](#installation)

To install this package, PHP 5.5+ and Composer are required

`$ composer require demola/potato-orm`

---

**Usage**
---------

[](#usage)

---

To use this package, what you need to do is to simply extend the base class. The base class is an abstract class called "DataBaseModel". Take for instance, you wish to perform the CRUD operations on the users table. Create a corresponding users class which should look like this:

```
use Demo;

class User extends DataBaseModel
{
}

```

- **Saving a new record to the table**

    ```
      $user               = new User();
      $user->name         = "Prosper Otemuyiwa";
      $user->sex          = "m";
      $user->occupation   = "Trainer";
      $user->organisation = "Andela";
      $user->year         = 2009;
      $user->save();

    ```
- **Read all record from the table**

    ```
      $users = User::getAll();
      print_r($users);

    ```
- **Read from a particular record in the table**

    ```
     $user = User::findById(3);
     print_r($user->getById());

    ```
- **Update a record in the table. For example, update the name of the tenth record in the users table:**

    ```
     $user       = User::findById(10);
     $user->name = "Gbolohan Kuti";
     $user->save();

    ```
- **Delete a record in the table. For example, delete the eighth record in the users table:**

    ```
     $users = User::destroy(8);

    ```
- **Exception Handling**

To make this package degrade gracefully, It has to be wrapped under try and catch in order for all exceptions to be caught.

- Catching exception on save new record:

    ```
      try {
          $user               = new User();
          $user->name         = "Prosper Otemuyiwa";
          $user->sex          = "m";
          $user->occupation   = "Trainer";
          $user->organisation = "Andela";
          $user->year         = 2009;
          $user->save();
          } catch(Exception $e) {
              print($e->getMessage());
          }

    ```
- Catching exception on reading from the table:

    ```
         /**
          * Read all record
          * /
         try {
             $users = User::getAll();
             print_r($users);
         } catch(Exception $e) {
             print($e->getMessage());
         }

         /**
          * Read from a particular record
          * /
         try {
             $user = User::findById(3);
             print_r($user->getById());
         } catch(Exception $e) {
             print($e->getMessage());
         }

    ```
- Catching exception on updating the table:

    ```
         try {
             $user       = User::findById(10);
             $user->name = "Gbolohan Kuti";
             $user->save();
          } catch(Exception $e) {
             print($e->getMessage());
          }

    ```
- Catching exception on deleting from the table:

    ```
          try {
              $users = User::destroy(8);
          } catch(Exception $e) {
              print($e->getMessage());
          }

    ```

**Testing**
-----------

[](#testing)

---

Run the following command in the potato-orm directory:

```
~ phpunit tests

```

**Change log**
--------------

[](#change-log)

---

Please check out [CHANGELOG](https://github.com/andela-araimi/potato-orm/blob/master/CHANGELOG.md) file for information on what has changed recently.

**Contributing**
----------------

[](#contributing)

---

Please check out [CONTRIBUTING](https://github.com/andela-araimi/potato-orm/blob/master/CONTRIBUTING.md) file for detailed contribution guidelines.

**Security**
------------

[](#security)

---

If you discover any issue, kindly contact

**Credits**
-----------

[](#credits)

---

Potato-ORM is maintained by Raimi Ademola.

**License**
-----------

[](#license)

---

Potato-ORM is released under the [MIT Licence](https://github.com/andela-araimi/potato-orm/blob/master/LICENSE.md). See the bundled LICENSE file for more details.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor4

4 contributors hold 50%+ of commits

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/f0e258a6b7938213c1fcb4f47a28c6a48b19a51891fe5f81c98414ad00b9b62e?d=identicon)[andela-araimi](/maintainers/andela-araimi)

---

Top Contributors

[![philsturgeon](https://avatars.githubusercontent.com/u/67381?v=4)](https://github.com/philsturgeon "philsturgeon (29 commits)")[![frankdejonge](https://avatars.githubusercontent.com/u/534693?v=4)](https://github.com/frankdejonge "frankdejonge (13 commits)")[![RobLoach](https://avatars.githubusercontent.com/u/25086?v=4)](https://github.com/RobLoach "RobLoach (7 commits)")[![bcrowe](https://avatars.githubusercontent.com/u/752603?v=4)](https://github.com/bcrowe "bcrowe (5 commits)")[![reinink](https://avatars.githubusercontent.com/u/882133?v=4)](https://github.com/reinink "reinink (5 commits)")[![colinodell](https://avatars.githubusercontent.com/u/202034?v=4)](https://github.com/colinodell "colinodell (4 commits)")[![marcqualie](https://avatars.githubusercontent.com/u/101022?v=4)](https://github.com/marcqualie "marcqualie (4 commits)")[![ravage84](https://avatars.githubusercontent.com/u/625761?v=4)](https://github.com/ravage84 "ravage84 (4 commits)")[![browner12](https://avatars.githubusercontent.com/u/5232313?v=4)](https://github.com/browner12 "browner12 (3 commits)")[![Princessdada](https://avatars.githubusercontent.com/u/106841602?v=4)](https://github.com/Princessdada "Princessdada (3 commits)")[![hassankhan](https://avatars.githubusercontent.com/u/1781985?v=4)](https://github.com/hassankhan "hassankhan (3 commits)")[![assertchris](https://avatars.githubusercontent.com/u/200609?v=4)](https://github.com/assertchris "assertchris (2 commits)")[![mAAdhaTTah](https://avatars.githubusercontent.com/u/4371429?v=4)](https://github.com/mAAdhaTTah "mAAdhaTTah (2 commits)")[![EmanueleMinotto](https://avatars.githubusercontent.com/u/417201?v=4)](https://github.com/EmanueleMinotto "EmanueleMinotto (2 commits)")[![kdubuc](https://avatars.githubusercontent.com/u/895661?v=4)](https://github.com/kdubuc "kdubuc (2 commits)")[![alexbilbie](https://avatars.githubusercontent.com/u/77991?v=4)](https://github.com/alexbilbie "alexbilbie (2 commits)")[![schmittjoh](https://avatars.githubusercontent.com/u/197017?v=4)](https://github.com/schmittjoh "schmittjoh (1 commits)")[![Anahkiasen](https://avatars.githubusercontent.com/u/1321596?v=4)](https://github.com/Anahkiasen "Anahkiasen (1 commits)")[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (1 commits)")[![bencorlett](https://avatars.githubusercontent.com/u/181919?v=4)](https://github.com/bencorlett "bencorlett (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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