Cinder
Cinder is a Mozilla Licensed PHP ORM Layer Written By Chareice.
Installing Cinder using Composer
-
Add
"cinder/cinder"
as dependency in your project'scomposer.json
file.{ "require": { "cinder/cinder": "dev-master" } }
-
Download and install Composer.
curl -s "http://getcomposer.org/installer" | php
-
Install your dependencies.
php composer.phar install
-
Require Composer's autoloader by adding the following line to your code's bootstrap process.
require '/path/to/vendor/autoload.php';
Usage
- At first, User must configure the connection to Database by using PDO Style:
<?php
require "vendor/autoload.php";
Cinder\Cinder::Config("mysql:host=localhost;dbname=app_test","root","pass");
- Then user can manipulate Cinder by offer it a
$options
variable like this:
$options = array(
"table" => "article",
"primary" => "id",
"field" => "title",
"value" => "Hello Wrold"
);
$article = Cinder\Cinder::getInstance($options);
Now $article
variable is the ORM Object that mapping to your row in article table which title equals "Hello World".