sirolad / potato-orm
A basic CRUD Object Relational Mapper
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
pkg:composer/sirolad/potato-orm
Requires
- vlucas/phpdotenv: ^2.0
Requires (Dev)
- mockery/mockery: ~0.9.4
- phpunit/phpunit: 4.8.*
This package is not auto-updated.
Last update: 2020-01-14 19:55:20 UTC
README
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