1. Go to this page and download the library: Download pavlyshyn/orm library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pavlyshyn / orm example snippets
use Pavlyshyn\Orm;
use Pavlyshyn\DB\Driver\MySQL;
use Model\User;
$orm = new Orm(new MySQL('localhost', 'test_orm', 'root', 'password'));
OR
use Pavlyshyn\DB\Driver\MongoDB;
$orm = new Orm(new MongoDB('localhost', 'test_orm'));
namespace Model;
use \Pavlyshyn\Model;
/**
* @tableName users
*/
class User extends Model {
protected $id;
protected $name;
protected $mail;
protected $password;
public function setId($id) {
return $this->id = $id;
}
public function getId() {
return $this->id;
}
public function setName($name) {
return $this->name = $name;
}
public function getName() {
return $this->name;
}
public function setMail($mail) {
return $this->mail = $mail;
}
public function getMail() {
return $this->mail;
}
public function setPassword($password) {
return $this->password = $password;
}
public function getPassword() {
return $this->password;
}
}