2017 © Pedro Peláez
 

library bookworm

A small ORM library written in PHP

image

symphlion/bookworm

A small ORM library written in PHP

  • Thursday, June 1, 2017
  • by Symphlion
  • Repository
  • 1 Watchers
  • 0 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Bookworm

A small ORM library written in PHP, (*1)


A small use case:, (*2)


// register your database to the pool and name it \Bookworm\Pool::createConnection('default', [ 'port' => 3306, 'driver' => 'mysql', 'host' => 'localhost', 'username' => 'your-username', 'password' => 'your-secret-password', 'database' => 'your-database' ]); use \Bookworm\Model; // the name of the class you`re using correlates to a corresponding table class User extends Model { // this is all that is required for a normal model } // if however, you want to name the table yourself, you can do so like this class MyLovelyPeople extends Model { protected $table = "my_users"; } // to use it, simply get a model by it`s primary ID $user = MyLovelyPeople::find(1); // or alternatively $fred = User::where("username", "=", "fred")->get(); // if you have a primary field which isn`t named id, you can define it as such class Preferences extends Model { protected $primary = 'preference_id'; } // and now you can use it like previously $preferences = Preferences::find(1); // if you want to retrieve a collection of types, you can use // retrieves all users ( note that it has a limit of a 100, to override, simply // add your own number of records to retrieve ) $users = User::all(); // to selectively retrieve a collection of items $authorized_users = User::where('authorization', '>=', 3)->all();

The Versions

01/06 2017

dev-master

9999999-dev https://github.com/Symphlion/Bookworm

A small ORM library written in PHP

  Sources   Download

MIT

The Requires

 

symphlion bookworm