Skip to content

A simple agnostic ORM that can perform the basic crud database operations.

License

Notifications You must be signed in to change notification settings

sirolad/potatoORM

Repository files navigation

PotatoORM

License Build Status Quality Score

This package performs basic CRUD operation using Object Relational Mapping(ORM) :

DIRECTORY STRUCTURE

src/           core package code
   |DB         database connection class
   |Entities   samples class to test the model class
   |Exceptions custom exception classes
   |Libraries  helper classes
tests/         tests of the core package

Installation

PHP 5.3+ and Composer are required.

Via Composer

$ composer require sirolad/potato-orm

or

"require": {
        "sirolad/potato-orm": "dev-master"
    }

Usage

Extend Potato class like so

    class Goat extends Potato
    {
    }

The following method can be used to access the classes

getAll

   $goat = Goat::getAll();
   print_r($goat);

This should print out all the ​goats ​in the ​goats ​table of Goat class.

find

    $goat = Goat::find(1);
    $goat->password = "ewure";
    echo $goat->save();

This should find the ​goat ​with id=1 in the goats table and change the password to ewure.

save

    $goat = new Goat();
    $goat->name = "billy";
    $goat->age  = 25;
    $goat->job  = "developer";
    $goat->save();

This should insert a record for goat billy in the goats table.

Update

    $goat = Goat::where('name', 'JackBauer');
    $goat->password = "wetina";
    $goat->save();

Change log

Please check out CHANGELOG file for information on what has changed recently.

Testing

$ vendor/bin/phpunit test
$ composer test

Contributing

Please check out CONTRIBUTING file for detailed contribution guidelines.

Credits

PotatoORM is developed and maintained by Surajudeen Akande.

License

PotatoORM is released under the MIT Licence. See the bundled LICENSE file for details.

Supported Databases

MySQL
PGSQL

About

A simple agnostic ORM that can perform the basic crud database operations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages