Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Repository files navigation

Latest Stable VersionBuild StatusTotal DownloadsLicensePHP 7 readyCode ClimateScrutinizer CQCode Coverage

DrMVC\Orm

Simple and easy-to-use lightweight ORM.

composer require drmvc/orm

Install

composer require drmvc/orm

How to use

<?phpuseDrMVC\Database;
useDrMVC\Config;
useDrMVC\Orm\Entity;
useDrMVC\Orm\Orm;
require_once__DIR__ . '/../vendor/autoload.php';
// Create config object and load database configuration$config = newConfig();
$config->load(__DIR__ . '/config.php');
// Open connection with database$db = newDatabase($config);
$instance = $db->getInstance();
$orm = newOrm('test_table', $instance);
$entity = newEntity();
$entity->name = 'Kolya';
$entity->email = 'qweqwe';
$entity->password = 'qwerty3';
$orm->saveEntity($entity);
// if find, update dataif ($entity = $orm->findById(1)) {
$entity->name = 'Pavel';
$entity->email = 'pavel@mail.ru';
$entity->password = 'qwerty3';
$orm->saveEntity($entity);
}
foreach ($orm->findAll() as$en) {
echo'<pre>' . print_r($en->name . ' - ' . $en->id, true) . '</pre>';
echo'<pre>' . print_r($orm->deleteEntity($en), true) . '</pre>';
}

About

Simple and easy-to-use lightweight ORM

Topics

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages