j4mie/paris
Composer 安装命令:
composer require j4mie/paris
包简介
A lightweight Active Record implementation for PHP5, built on top of Idiorm
关键字:
README 文档
README
https://j4mie.github.io/idiormandparis/
In maintenance only mode
Idiorm and Paris are now considered to be feature complete as of version 1.5.0. Whilst they will continue to be maintained with bug fixes there will be no further new features added from this point on. This means that if a pull request makes breaking changes to the API or requires anything other than a patch version bump of the library then it will not be merged.
Please do not submit feature requests or API breaking changes as they will be closed without ceremony.
Should I use Idiorm/Paris?
If you're starting a new project
It is not recommended that you use either Idiorm or Paris in new projects.
I recommend that you use the Eloquent database library from Laravel as Taylor based it on Idiorm when he wrote it. This means that many of the same ideas are present there, but it is more actively maintained and has a more modern code style.
If you have existing projects based on Idiorm or Paris
You can continue to use both projects as they will continue to receive security patches and bug fixes. It is important to note that future versions of PHP may not be supported if changes they require would break backwards compatibility.
At this point you can either use another database library such as Eloquent from Laravel (see If you're starting a new project above) or you could decide to fork Idiorm and/or Paris to patch them with your own modifications.
But, why?
For further information on the state of this project please see j4mie/idiorm#360
A lightweight Active Record implementation for PHP5.
Built on top of Idiorm.
Tested on PHP 5.2.0+ - may work on earlier versions with PDO and the correct database drivers.
Released under a BSD license.
Features
- Extremely simple configuration.
- Exposes the full power of Idiorm's fluent query API.
- Supports associations.
- Simple mechanism to encapsulate common queries in filter methods.
- Built on top of PDO.
- Uses prepared statements throughout to protect against SQL injection attacks.
- Database agnostic. Currently supports SQLite, MySQL, Firebird and PostgreSQL. May support others, please give it a try!
- Supports collections of models with method chaining to filter or apply actions to multiple results at once.
- Multiple connections are supported
Documentation
The documentation is hosted on Read the Docs: paris.rtfd.org
Building the Docs
You will need to install Sphinx and then in the docs folder run:
make html
The documentation will now be in docs/_build/html/index.html
Let's See Some Code
class User extends Model { public function tweets() { return $this->has_many('Tweet'); } } 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; }
Changelog
1.5.6 - released 2017-03-21
- Allow IDE's to autocomplete when
foreachoverfind_many()result [stratoss] - issue #128 - Document the @property PHPDoc comment for IDE autocomplete of model properties [Treffynnon]
1.5.5 - released 2016-12-14
- Fix join table name not generated correctly [Ralphunter] - issue #109
- Add phpunit as dev dependency and composer script (
composer test) to easily run tests [Treffynnon] - Global setting to allow static requests to avoid being forced in to using the namespace + class as the auto table name [michaelward82] - issue #100
- Document conflict between static Model calling and auto_prefix_models [michaelward82] - issue #102
- Added @method tags for magic methods [stellis] - issue #104
- Add missing
__unset()magic method [qyanu] - issue #106 - Remove PHP 5.2 from travis-ci containers to test against (note Idiorm still supports PHP 5.2 despite this) [Treffynnon]
1.5.4 - released 2014-09-23
- Corrects return value in docblock for 2 Model functions [michaelward82] - issue #99
1.5.3 - released 2014-06-25
- Remove erroneously committed git merge backup file
1.5.2 - released 2014-06-23
1.5.1 - released 2014-06-22
- Remove HHVM build target from travis-ci as there is a bug in HHVM
1.5.0 - released 2014-06-22
- Allows static calling of Model subclasses, ignoring namespace info during table name generation [michaelward82] - issue #90
- Prevent invalid method calls from triggering infinite recursion [michaelward82] - issue #75
- Allow chaining of the
set()andset_expr()methods [naga3] - issue #94 - Add HHVM to travis-ci build matrix [ptarjan] - issue #81
- Improve join documentation [rhynodesigns] - issue #92
- Improve code docblock [michaelward82] - issue #91
- Improve code docblocks and whitespace [michaelward82] - issue #93
- Improve connections documentation [kkeiper1103] - issue #79
1.4.2 - released 2013-12-12
Patch update to remove a broken pull request - may have consequences for users of 1.4.0 and 1.4.1 that exploited the "find_many() now returns an associative array with the databases primary ID as the array keys" change that was merged in 1.4.0.
- Back out pull request/issue #133 as it breaks backwards compatibility in previously unexpected ways (see Idiorm issues #162, #156 and #133) - sorry for merging this change into Paris - closes Idiorm issue 156
1.4.1 - released 2013-09-05
- Increment composer.json requirement for Idiorm to 1.4.0 [michaelward82] - Issue #72
1.4.0 - released 2013-09-05
- Call methods against model class directly eg.
User::find_many()- PHP 5.3 only [Lapayo] - issue #62 find_many()now returns an associative array with the databases primary ID as the array keys [Surt] - see commit 9ac0ae7 and Idiorm issue #133- Add PSR-1 compliant camelCase method calls to Idiorm (PHP 5.3+ required) [crhayes] - issue #59
- Allow specification of connection on relation methods [alexandrusavin] - issue #55
- Make tests/bootstrap.php HHVM compatible [JoelMarcey] - issue #71
- belongs_to doesn't work with $auto_prefix_models (issue #70)
1.3.0 - released 2013-01-31
- Documentation moved to paris.rtfd.org and now built using Sphinx
- Add support for multiple database connections [tag] - issue #15
- Allow a prefix for model class names - see Configuration in the documentation - closes issues #33
- Exclude tests and git files from git exports (used by composer)
- Implement
set_expr- closes issue #39 - Add
is_new- closes issue #40 - Add support for the new IdiormResultSet object in Idiorm - closes issue #14
- Change Composer to use a classmap so that autoloading is better supported [javierd] - issue #44
- Move tests into PHPUnit to match Idiorm
- Update included Idiorm version for tests
- Move documentation to use Sphinx
1.2.0 - released 2012-11-14
- Setup composer for installation via packagist (j4mie/paris)
- Add in basic namespace support, see issue #20
- Allow properties to be set as an associative array in
set(), see issue #13 - Patch in idiorm now allows empty models to be saved (j4mie/idiorm see issue #58)
1.1.1 - released 2011-01-30
- Fix incorrect tests, see issue #12
1.1.0 - released 2011-01-24
- Add
is_dirtymethod
1.0.0 - released 2010-12-01
- Initial release
j4mie/paris 适用场景与选型建议
j4mie/paris 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 522.35k 次下载、GitHub Stars 达 987, 最近一次更新时间为 2012 年 11 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「orm」 「Active Record」 「model」 「paris」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 j4mie/paris 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 j4mie/paris 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 j4mie/paris 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Propel2 is an open-source Object-Relational Mapping (ORM) for PHP 5.5 and up.
Kinikit - PHP Application development framework MVC component
PHP Interface for Babel Street Text Analytics
A Symfony extension to get active class base on current bundle/controller/action
PHP Database ORM for Symfony1. Do NOT use for new projects: please move to a newest Symfony release and Doctrine2
LDAP user provider bundle for Symfony 6.4
统计信息
- 总下载量: 522.35k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1004
- 点击次数: 24
- 依赖项目数: 31
- 推荐数: 1
其他信息
- 授权协议: BSD-2-Clause
- 更新时间: 2012-11-14