1. Go to this page and download the library: Download arojunior/php-orm-pdo 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/ */
arojunior / php-orm-pdo example snippets
use SimpleORM\core\model\Model;
class AppModel extends Model
{
public $db_config = [
'db_host' => '192.168.1.1',
'db_name' => 'test',
'db_user' => 'root',
'db_pass' => ''
];
}
use YourNamespace\AppModel;
class Example extends AppModel
{
public $table = 't_user';
public $pk = 'user_id';
public function getAll()
{
return $this->findAll();
}
}
namespace SimpleORM\app\model;
use SimpleORM\core\model\Model;
class Users extends Model
{
/*
* * Basic configuration
* These arguments are optionals
* protected $table = 'users'; //just if the class name a table name are different
* protected $pk = 'id'; //just if the primary key name is not id
*/
}