quidphp/orm
Composer 安装命令:
composer require quidphp/orm
包简介
PHP library that provides database access and a comprehensive ORM
关键字:
README 文档
README
About
QuidPHP/Orm is a PHP library that provides database abstraction using PDO and an easy-to-use Object-Relational Mapper (ORM). It is part of the QuidPHP package and can also be used standalone.
License
QuidPHP/Orm is available as an open-source software under the MIT license.
Documentation
QuidPHP/Orm documentation is available at QuidPHP/Docs.
Installation
QuidPHP/Orm can be easily installed with Composer. It is available on Packagist.
$ composer require quidphp/orm
Once installed, the Quid\Orm namespace will be available within your PHP application.
Requirement
QuidPHP/Orm requires the following:
- PHP 8.1 with these extensions:
- PDO
- pdo_mysql
- Mysql (>= 8.0) or MariaDB (>= 10.4) database
- All requirements of quidphp/main
Dependency
QuidPHP/Orm has the following dependency:
- quidphp/main - Quid\Main - PHP library that provides a set of base objects and collections
The dependency will be resolved by using the Composer installation process.
Comment
QuidPHP/Orm code is commented and all methods are explained (in French).
Convention
QuidPHP/Orm is built on the following conventions:
- Coding: No curly braces are used in a IF statement if the condition can be resolved in only one statement.
- Config: A special $config static property exists in all classes. This property gets recursively merged with the parents' property on initialization.
- Dynamic singleton: Table, Col, Row and Cell objects can only exist once for a same source.
- Traits: Traits filenames start with an underscore (_).
- Type: Files, function arguments and return types are strict typed.
Overview
QuidPHP/Orm contains 45 classes and traits. Here is an overview:
- CatchableException - Class used for a catchable database query exception
- Cell - Class to represent an existing cell within a row
- Cells - Class for a collection of many cells within a same row
- CellsIndex - Class for a collection of cells within different tables (keys are indexed)
- CellsMap - Root class for a collection of cells
- Classe - Class required to identify which class needs to be used by the different ORM components
- Col - Class to represent an existing column within a table
- ColRelation - Class to access the relation data of a column
- ColSchema - Class used to parse the information schema of a column
- Cols - Class for a collection of many columns within a same table
- ColsIndex - Class for a collection of cols within different tables (keys are indexed)
- ColsMap - Root class for a collection of cols
- Db - Class used to query the database and to link the results to the different ORM components
- Exception - Class used for a database query exception
- History - Class used to store the history of requests made to the database object
- Lang - Extended class for an object containing language texts related to the database
- Map - Root class for a collection of cells, cols or rows
- Operation - Abstract class used for a complex operation on the database
- Pdo - Class used to query the database using the PDO object
- PdoSql - Class used to build an sql query in a object-oriented way, not linked to ORM components
- Relation - Abstract class that is extended by ColRelation and Relation
- Row - Class to represent an existing row within a table
- RowOperation - Abstract class used for a complex operation on a table row
- Rows - Class for a collection of many rows within a same table
- RowsIndex - Class for a collection of rows within different tables (keys are indexed)
- RowsMap - Root class for a collection of rows
- Schema - Class that provides a schema for a database with tables and columns information
- Sql - Class used to build a sql query in a object-oriented way, uses the DB class (linked to the ORM components)
- Syntax - Abstract class with static methods to generate SQL syntax
- Mysql - Class with static methods to generate MySQL syntax strings (compatible with MySQL and MariaDB)
- Table - Class to represent an existing table within a database
- TableClasse - Class required to identify which class needs to be used by the different ORM components of a table
- TableOperation - Abstract class used for a complex operation on a database table
- TableRelation - Class to access the relation data of a table
- Tables - Class for a collection of many tables within a same database
- _colCell - Trait that provides common methods for Col and Cell objects
- _dbAccess - Trait that grants database access to the class using
- _mapIndex - Trait that grants common methods for indexed collections (cols, cells, rows)
- _tableAccess - Trait that grants table access to the class using
Testing
QuidPHP/Orm contains 26 test classes:
- CatchableException - Class for testing Quid\Orm\CatchableException
- Cell - Class for testing Quid\Orm\Cell
- Cells - Class for testing Quid\Orm\Cells
- CellsIndex - Class for testing Quid\Orm\CellsIndex
- Classe - Class for testing Quid\Orm\Classe
- Col - Class for testing Quid\Orm\Col
- ColRelation - Class for testing Quid\Orm\ColRelation
- ColSchema - Class for testing Quid\Orm\ColSchema
- Cols - Class for testing Quid\Orm\Cols
- ColsIndex - Class for testing Quid\Orm\ColsIndex
- Db - Class for testing Quid\Orm\Db
- Exception - Class for testing Quid\Orm\Exception
- History - Class for testing Quid\Orm\History
- Lang - Class for testing Quid\Orm\Lang
- Pdo - Class for testing Quid\Orm\Pdo
- PdoSql - Class for testing Quid\Orm\PdoSql
- Row - Class for testing Quid\Orm\Row
- Rows - Class for testing Quid\Orm\Rows
- RowsIndex - Class for testing Quid\Orm\RowsIndex
- Schema - Class for testing Quid\Orm\Schema
- Sql - Class for testing Quid\Orm\Sql
- Syntax - Class for testing Quid\Orm\Syntax
- Table - Class for testing Quid\Orm\Table
- TableClasse - Class for testing Quid\Orm\TableClasse
- TableRelation - Class for testing Quid\Orm\TableRelation
- Tables - Class for testing Quid\Orm\Tables
QuidPHP/Orm testsuite can be run by creating a new QuidPHP/Assert project.
quidphp/orm 适用场景与选型建议
quidphp/orm 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 211 次下载、GitHub Stars 达 5, 最近一次更新时间为 2019 年 08 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php-framework」 「quid」 「quidphp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 quidphp/orm 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 quidphp/orm 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 quidphp/orm 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A lightweight, secure-by-default PHP microframework built on Slim – providing Laravel-like features (ORM, authentication, migrations, caching) without the bloat. Perfect for building REST APIs and small-to-medium PHP applications.
A PHP nano framework for REST API's & Micro-Services
The Core Framework for MightyPHP Framework
PHP library that provides a set of base objects and collections
PHP library that provides an extendable platform to create dynamic applications
Oauth 2 client for Ubiquity framework
统计信息
- 总下载量: 211
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-27