Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drmvc/orm
Simple and easy-to-use lightweight ORM
https://github.com/drmvc/orm
database orm sql
Last synced: 2 days ago
JSON representation
Simple and easy-to-use lightweight ORM
- Host: GitHub
- URL: https://github.com/drmvc/orm
- Owner: drmvc
- License: mit
- Created: 2018-04-03T01:50:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-04-18T23:35:02.000Z (over 6 years ago)
- Last Synced: 2024-04-04T02:02:56.321Z (8 months ago)
- Topics: database, orm, sql
- Language: PHP
- Homepage: https://drmvc.com
- Size: 45.9 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[![Latest Stable Version](https://poser.pugx.org/drmvc/orm/v/stable)](https://packagist.org/packages/drmvc/orm)
[![Build Status](https://travis-ci.org/drmvc/orm.svg?branch=master)](https://travis-ci.org/drmvc/orm)
[![Total Downloads](https://poser.pugx.org/drmvc/orm/downloads)](https://packagist.org/packages/drmvc/orm)
[![License](https://poser.pugx.org/drmvc/orm/license)](https://packagist.org/packages/drmvc/orm)
[![PHP 7 ready](https://php7ready.timesplinter.ch/drmvc/orm/master/badge.svg)](https://travis-ci.org/drmvc/orm)
[![Code Climate](https://codeclimate.com/github/drmvc/orm/badges/gpa.svg)](https://codeclimate.com/github/drmvc/orm)
[![Scrutinizer CQ](https://scrutinizer-ci.com/g/drmvc/orm/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/drmvc/orm/)
[![Code Coverage](https://scrutinizer-ci.com/g/drmvc/orm/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/drmvc/orm/?branch=master)# DrMVC\Orm
Simple and easy-to-use lightweight ORM.
composer require drmvc/orm
## Install
composer require drmvc/orm
## How to use
```php
load(__DIR__ . '/config.php');
// Open connection with database
$db = new Database($config);
$instance = $db->getInstance();$orm = new Orm('test_table', $instance);
$entity = new Entity();
$entity->name = 'Kolya';
$entity->email = 'qweqwe';
$entity->password = 'qwerty3';$orm->saveEntity($entity);
// if find, update data
if ($entity = $orm->findById(1)) {
$entity->name = 'Pavel';
$entity->email = '[email protected]';
$entity->password = 'qwerty3';
$orm->saveEntity($entity);
}foreach ($orm->findAll() as $en) {
echo '' . print_r($en->name . ' - ' . $en->id, true) . '';
echo '' . print_r($orm->deleteEntity($en), true) . '';
}
```