dev-master
9999999-devThis is an ORM package that manages the persistence of database CRUD operations.
MIT
The Requires
- php >=5.5
- vlucas/phpdotenv ^2.0
The Development Requires
by Kolawole Erinoso
orm persistence
Wallogit.com
2017 © Pedro Peláez
This is an ORM package that manages the persistence of database CRUD operations.
This is an ORM package that manages the persistence of simple database CRUD operations., (*2)
PHP 5.5+ and Composer are required., (*3)
Via Composer, (*4)
``` bash $ composer require kola/potato-orm, (*5)
``` bash $ composer install
Create a class with the name of the corresponding table in the database. Extend the class to the base class Model under the namespace Kola\PotatoOrm., (*6)
For instance, a class for dogs or Dogs or dog or Dog table should look like this:, (*7)
``` php namespace Kola\PotatoOrm;, (*8)
class Dog extends Model { }, (*9)
* Create and save a record to database ``` php $dog = new Dog(); $dog->name = "Rex"; $dog->breed= "Alsatian"; $dog->origin = "Germany"; $dog->save();
``` php $dog = Dog::find(4); $dog->name = "Bruno"; $dog->save();, (*10)
OR ``` php $dog = Dog::where('name', 'Rex'); $dog->breed = "Rottweiler"; $dog->save();
``` php $dog = Dog::destroy(2);, (*11)
Feel free to name the class as the singular of the name of the database table. For instance, `User` class for `users` table. `Note: Plurals of irregular nouns are not supported` For instance, a class `Fish` should map to a table `fish` or `fishs`, not `fishes`. And a class `Child` should map to a table `child` or `childs`, not `children`. ## Supported database Currently, only MYSQL and PostgreSQL are supported. Work towards the support for other popular databases is in progress. ## Change log Please check out [CHANGELOG](CHANGELOG.md) file for information on what has changed recently. ## Testing ``` bash $ vendor/bin/phpunit test
Please check out CONTRIBUTING file for detailed contribution guidelines., (*12)
potato-orm is maintained by Kolawole ERINOSO., (*13)
potato-orm is released under the MIT Licence. See the bundled LICENSE file for details., (*14)
This is an ORM package that manages the persistence of database CRUD operations.
MIT
orm persistence