2017 © Pedro Peláez
 

library potato-orm

An ORM package that allows you to perform basic CRUD operations on any database

image

vundi/potato-orm

An ORM package that allows you to perform basic CRUD operations on any database

  • Thursday, April 21, 2016
  • by vickris
  • Repository
  • 2 Watchers
  • 2 Stars
  • 98 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

POTATO ORM

Build Status Coverage Status Scrutinizer Code Quality ![Software License][ico-license], (*1)

POTATO ORM is a custom ORM that allows you to perform all CRUD operations on a table when working with any database, (*2)

Install

Installation via Composer, (*3)

``` bash $ composer require vundi/potato-orm, (*4)


## Usage #### Configuration SQL databases **NOTE:** Load you connection variables from the `.env` file in the root folder. If you do not have a `.env` file in your root folder or don't know about it, please read this [phpdotenv project](https://github.com/vlucas/phpdotenv). Provide `Database host`, `database user`, `database password` and the `type` in the .env file. Once you provide the right values a Database connection will be established. ``` php // Load the `.env` variables for the project // Check the `.env.example` file in the root of the project to see the environment variables needed. $dotenv = new Dotenv\Dotenv(__DIR__); $dotenv->load();

Once we have a connection, we create a model class which extends Model. Inside the model class set the entity table name ``` php require 'vendor/autoload.php';, (*5)

use Vundi\Potato\Model; use Vundi\Potato\Exceptions\NonExistentID; use Vundi\Potato\Exceptions\IDShouldBeNumber;, (*6)

class User extends Model { protected static $entity_table = 'Person'; }, (*7)


Database interactions ``` php // create a new user $user = new User; $user->name = "Kevin Karugu"; $user->age = 23; $user->company = "Andela"; $user->save();

Get all users from the users table, (*8)

$users = User::findAll(); // Returns an array of the users found in the db

Get a single user from the users table, (*9)

$user = User::find(2); // will return user with an ID of 2

Edit an existing user, (*10)

$user = User::find(2);
$user->name = "Devy Kerr";
$user->company = "Suyabay";
$user->update();

Delete a user, (*11)

//Will remove a user from the database table
User::remove(2); // 2 represents the id of the user to be removed

Credits

License

The MIT License (MIT). Please see License File for more information., (*12)

The Versions

21/04 2016

dev-master

9999999-dev https://github.com/andela-cvundi/potatoORM

An ORM package that allows you to perform basic CRUD operations on any database

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christopher Vundi

orm database crud pdo

18/04 2016

dev-revert-6-fix-sql-order-position

dev-revert-6-fix-sql-order-position https://github.com/andela-cvundi/potatoORM

An ORM package that allows you to perform basic CRUD operations on any database

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christopher Vundi

orm database crud pdo

03/03 2016

dev-development

dev-development https://github.com/andela-cvundi/potatoORM

An ORM package that allows you to perform basic CRUD operations on any database

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christopher Vundi

orm database crud pdo

03/03 2016

1.0.5

1.0.5.0 https://github.com/andela-cvundi/potatoORM

An ORM package that allows you to perform basic CRUD operations on any database

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christopher Vundi

orm database crud pdo

03/03 2016

dev-ideal

dev-ideal https://github.com/andela-cvundi/potatoORM

An ORM package that allows you to perform basic CRUD operations on any database

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christopher Vundi

orm database crud pdo

03/03 2016

1.0.4

1.0.4.0 https://github.com/andela-cvundi/potatoORM

An ORM package that allows you to perform basic CRUD operations on any database

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christopher Vundi

orm database crud pdo

03/03 2016

1.0.3

1.0.3.0 https://github.com/andela-cvundi/potatoORM

An ORM package that allows you to perform basic CRUD operations on any database

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christopher Vundi

orm database crud pdo

02/03 2016

1.0.2

1.0.2.0 https://github.com/andela-cvundi/potatoORM

An ORM package that allows you to perform basic CRUD operations on any database

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christopher Vundi

orm database crud pdo

29/02 2016

1.0.1

1.0.1.0 https://github.com/andela-cvundi/potatoORM

An ORM package that allows you to perform basic CRUD operations on any database

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christopher Vundi

orm database crud pdo

11/02 2016

1.0.0

1.0.0.0 https://github.com/andela-cvundi/potatoORM

An ORM package that allows you to perform basic CRUD operations on any database

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christopher Vundi

orm database crud pdo