承接 minond/model 相关项目开发

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

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

minond/model

Composer 安装命令:

composer require minond/model

包简介

Object models

README 文档

README

Build Status Coverage Status Latest Stable Version Dependencies Status Scrutinizer Quality Score SensioLabsInsight

Models that are simple to create and use. Light weight but easily extensible.

Getters and setters will be simulated using the magic call method:

use Efficio\Dataset\Model;

class User extends Model
{
    protected $first_name;
    protected $last_name;
    protected $full_name;
}
$me = new User;

// methods
$me->setFirstName('Marcos');
$me->setLastName('Minond');

// or properties
$me->first_name = 'Marcos';
$me->last_name = 'Marcos';

Both getter and setter methods may be overwritten:

use Efficio\Dataset\Model;

class User extends Model
{
    protected $first_name;
    protected $last_name;
    protected $full_name;

    public function getFullName()
    {
        return implode(' ', [ $this->first_name, $this->last_name ]);
    }
}
$me = new User;
$me->first_name = 'Marcos';
$me->last_name = 'Marcos';

echo $me->full_name; // outputs 'Marcos Minond'

Traits are used to specify how models are stored:

use Efficio\Dataset\Model;
use Efficio\Dataset\Storage\Model\DatabaseStorage;

class User extends Model
{
    use DatabaseStorage;

    protected $first_name;
    // ...
}

Current storage traits are:

  • Efficio\Dataset\Storage\Model\DatabaseStorage - store in a database using PDO.
  • Efficio\Dataset\Storage\Model\FileStorage - store in flat files.
  • Efficio\Dataset\Storage\Model\NullStorage - no storage.
  • Efficio\Dataset\Storage\Model\SessionStorage - stored in the $_SESSION array

Since storage information is defined in the model level any sort of custom storage may be used.

Configuring storage methods

DatabaseStorage
// User uses DatabaseStorage trait
User::setConnection(new PDO('sqlite::memory:'));
FileStorage
// User uses FileStorage trait
User::setDirectory('./cache/models/');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2013-06-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固