定制 monomelodies/ornament 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

monomelodies/ornament

最新稳定版本:0.8.3

Composer 安装命令:

composer require monomelodies/ornament

包简介

PHP5 ORM toolkit

关键字:

README 文档

README

PHP5 ORM toolkit

ORM is a fickle beast. Many libraries (e.g. Propel, Doctrine, Eloquent etc) assume your database should correspond to your models. This is simply not the case; models contain business logic and may, may not or may in part refer to database tables, NoSQL databases, flat files, an external API or whatever. The point is: the models shouldn't care, and there should be no "conventional" mapping through their names. (A common example would be a model of pages in multiple languages, where the data might be stored in a page table and a page_i18n table for the language-specific data.)

Also, the use of extensive and/or complicated config files sucks. (XML? This is 2015, people!)

Installation

Composer (recommended)

Add "monomelodies/ornament" to your composer.json requirements:

$ composer require monomelodies/ornament

Manual installation

  1. Get the code;
    1. Clone the repository, e.g. from GitHub;
    2. Download the ZIP (e.g. from Github) and extract.
  2. Make your project recognize Ornament:
    1. Register /path/to/ornament/src for the namespace Ornament\\ in your PSR-4 autoloader (recommended);
    2. Alternatively, manually include the files you need.

Basic usage

Ornament models (or "entities" if you're used to Doctrine-speak) are really nothing more than vanilla PHP classes; there is no need to extend any base object of sorts (since you might want to do that in your own framework!).

Ornament is a toolkit, so it supplies a number of Traits one can use to extend your models' behaviour beyond the ordinary.

The most basic implementation would look as follows:

<?php

use Ornament\Model;
use Ornament\Adapter\Pdo;

class MyModel
{
    use Model;

    // Public properties on a Model are considered "handleable" by Ornament:
    public $id;
    public $name;
    public $value;

    public function __construct()
    {
        $this->addAdapter(new Pdo($GLOBALS['database']));
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固