This package performs basic CRUD operation using Object Relational Mapping(ORM) :
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
PHP 5.3+ and Composer are required.
Via Composer
$ composer require sirolad/potato-orm
or
"require": {
"sirolad/potato-orm": "dev-master"
}
Extend Potato
class like so
class Goat extends Potato
{
}
The following method can be used to access the classes
$goat = Goat::getAll();
print_r($goat);
This should print out all the goats in the goats table of Goat class.
$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
.
$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.
$goat = Goat::where('name', 'JackBauer');
$goat->password = "wetina";
$goat->save();
Please check out CHANGELOG file for information on what has changed recently.
$ vendor/bin/phpunit test
$ composer test
Please check out CONTRIBUTING file for detailed contribution guidelines.
PotatoORM is developed and maintained by Surajudeen Akande
.
PotatoORM is released under the MIT Licence. See the bundled LICENSE file for details.
MySQL
PGSQL