承接 divengine/orm 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

divengine/orm

Composer 安装命令:

composer require divengine/orm

包简介

Div PHP Object Relational Mapping

README 文档

README

Div PHP ORM is a lightweight, class-based ORM that maps database rows to PHP objects using inheritance and reflection. It is designed for small projects where you want explicit mappings without a large framework.

Requirements

  • PHP 8.0 or higher
  • ext-pdo, ext-json

Installation

composer require divengine/orm

Quick start

<?php

require 'vendor/autoload.php';

use divengine\orm;

class PublicMap extends orm
{
    protected $__map_type = self::SCHEMA;
    protected $__map_schema = 'public';
    protected $__map_identity = 'id = :id';
}

class PersonMap extends PublicMap
{
    protected $__map_type = self::RECORD;
    protected $__map_name = 'person';
    protected $__map_class = Person::class;
}

class Person extends PersonMap
{
    public $id = self::AUTOMATIC;
    public $name;
}

class PersonCollection extends PersonMap
{
    protected $__map_type = self::TABLE;
}

$pdo = orm::buildPDO([
    'type' => 'pgsql',
    'host' => 'localhost',
    'port' => 5432,
    'name' => 'mydb',
    'user' => 'me',
    'pass' => 'secret'
], true);

$person = new Person(['name' => 'Peter']);
$person->insert();

$list = new PersonCollection();
$first = $list->getFirstItem('id = ?', [100]);

Docs

See docs/README.md for installation, mapping, and usage guides.

License

This project is licensed under the GNU General Public License. See LICENSE.

统计信息

  • 总下载量: 275
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2019-09-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固