voku / paris
v1.7.6
2017-08-10 19:52 UTC
Requires
- php: >=5.3.0
- voku/idiorm: ~2.1
Requires (Dev)
- phpunit/phpunit: ~4.0|~5.0
- dev-master
- v1.7.6
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.7
- v1.6.6
- v1.6.5
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.6
- v1.5.5
- v1.5.4
- v1.5.3
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.0
- dev-renovate/configure
- dev-whitesource/configure
- dev-analysis-qg5rG5
- dev-analysis-8mnMYX
- dev-develop
This package is auto-updated.
Last update: 2023-04-03 23:06:19 UTC
README
Paris
http://j4mie.github.com/idiormandparis/
警告:此仅为从以下地址的维护分支:"https://github.com/j4mie/paris/"
信息:您可以使用我的Simple Active Record库代替Paris: "https://github.com/voku/simple-active-record"
安装
推荐的安装方式是通过Composer。
$ composer require voku/paris
PHP5的轻量级Active Record实现。
基于Idiorm构建。
在PHP 5.3+上进行了测试 - 可能可以在较旧版本上通过PDO和正确的数据库驱动程序工作。
在BSD许可下发布。
特性
- 极其简单的配置。
- 暴露了Idiorm的全功能流畅查询API。
- 支持关联。
- 简单的机制来封装常用的查询在过滤器方法中。
- 基于PDO。
- 使用预处理语句来防止SQL注入攻击。
- 数据库无关。目前支持SQLite、MySQL、Firebird和PostgreSQL。可能支持其他数据库,请尝试!
- 支持使用方法链对模型集合进行过滤或同时对多个结果应用操作。
- 支持多个连接
文档
文档托管在Read the Docs上:paris.rtfd.org
构建文档
您需要安装Sphinx,然后在文档文件夹中运行
make html
现在文档将在docs/_build/html/index.html
看看一些代码
/** * User: a sample user-class * * @property-read int $id * @property-read string $first_name */ class User extends Model { public function tweets() { return $this->has_many('Tweet'); } public function getId() { return $this->id; } public function getFirstName() { return $this->first_name } } /** * Tweet: a sample twitter-class * * @property-read int $id * @property-read string $text */ class Tweet extends Model { } $user = Model::factory('User') ->where_equal('username', 'j4mie') ->find_one(); $user->first_name = 'Jamie'; $user->save(); $tweets = $user->tweets()->find_many(); foreach ($tweets as $tweet) { echo $tweet->text; }