dev-master
9999999-devA simple PHP agnostic ORM
The Requires
- php >=5.3.0
- vlucas/phpdotenv ^2.1
The Development Requires
by :Wilson Omokoro
Wallogit.com
2017 © Pedro Peláez
A simple PHP agnostic ORM
A simple ORM to insert, read, update, and delete data from a database written in PHP., (*2)
Via Composer, (*3)
``` bash $ composer require Wilson/potato-orm, (*4)
## Usage - Simply extend the base class. The base class is an abstract class called "Base". So for example if you have a users table in the database and you wish to perform create, read, update, and delete (CRUD) operations on the table, create a corresponding class like this
use Wilson\Source\Base;, (*5)
class User extends Base {, (*6)
}, (*7)
- Insert a record into the table
$person = new User(); $person->name = "Wilson Omokoro"; $person->email = "wilson.omokoro@andela.com"; $person->password = "12345"; $person->save();, (*8)
- Find a particular record in the table
$user = User::find(3); echo $user->result;, (*9)
- Read all records from the table
$users = User::getAll(); print_r($users);, (*10)
- Update a record in the table. For example update the password of the fifth record in the users table:
$user = User::find(5); $user->password = "lkHJu9Z"; $user->save();, (*11)
- Delete a record from the table. For example delete the third record in the users table:
$user = User::destroy(3);, (*12)
## Testing If the folder containing your test classes is "tests"
$ phpunit tests ```, (*13)
Please see CHANGELOG for more information what has changed recently., (*14)
Please see CONTRIBUTING and CONDUCT for details., (*15)
If you discover any security related issues, please email wilson.omokoro@andela.com instead of using the issue tracker., (*16)
Potato-orm is maintained by Wilson Omokoro., (*17)
The MIT License (MIT). Please see License File for more information., (*18)
A simple PHP agnostic ORM