ttl/doctrine-extensions
最新稳定版本:3.13
Composer 安装命令:
composer require ttl/doctrine-extensions
包简介
Doctrine behavioral extensions
关键字:
README 文档
README
This package contains extensions for Doctrine ORM and MongoDB ODM that offer new functionality or tools to use Doctrine more efficiently. These behaviors can be easily attached to the event system of Doctrine and handle the records being flushed in a behavioral way.
Doctrine Extensions 3.0 Released 🎉
3.0 focuses on refreshing this package for today's PHP. This includes:
- Bumping minimum version requirements of PHP, Doctrine, and other dependencies
- Implementing support for the latest Doctrine MongoDB & Common packages
- Updating the test suite, add code and style standards, and other needed build tools
- Cleaning up documentation, code, comments, etc.
Read the Upgrade Doc for more info.
Installation
composer require gedmo/doctrine-extensions
Upgrading
Extensions
ORM & MongoDB ODM
- Blameable - updates string or reference fields on create, update and even property change with a string or object (e.g. user).
- Loggable - helps tracking changes and history of objects, also supports version management.
- Sluggable - urlizes your specified fields into single unique slug
- Timestampable - updates date fields on create, update and even property change.
- Translatable - gives you a very handy solution for translating records into different languages. Easy to setup, easier to use.
- Tree - automates the tree handling process and adds some tree-specific functions on repository. (closure, nested set or materialized path) (MongoDB ODM only supports materialized path)
ORM Only
- IpTraceable - inherited from Timestampable, sets IP address instead of timestamp
- SoftDeleteable - allows to implicitly remove records
- Sortable - makes any document or entity sortable
- Uploadable - provides file upload handling in entity fields
MongoDB ODM Only
- References - supports linking Entities in Documents and vice versa
- ReferenceIntegrity - constrains ODM MongoDB Document references
All extensions support Attribute, Annotation and XML mapping. Additional mapping drivers can be easily implemented using Mapping extension to handle the additional metadata mapping.
Version Compatibility
| Extensions Version | Compatible Doctrine ORM & Common Library |
|---|---|
| 2.4 | 2.5+ |
| 2.3 | 2.2 - 2.4 |
If you are setting up the Entity Manager without a framework, see the example to prevent issues like #1310
XML Mapping
XML mapping needs to be in a different namespace, the declared namespace for Doctrine extensions is http://gediminasm.org/schemas/orm/doctrine-extensions-mapping So root node now looks like this:
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping"> ... </doctrine-mapping>
XML mapping xsd schemas are also versioned and can be used by version suffix:
- Latest version - http://gediminasm.org/schemas/orm/doctrine-extensions-mapping
- 2.2.x version - http://gediminasm.org/schemas/orm/doctrine-extensions-mapping-2-2
- 2.1.x version - http://gediminasm.org/schemas/orm/doctrine-extensions-mapping-2-1
Running Tests
To set up and run the tests, follow these steps:
- Install Docker and ensure you have
docker compose - From the project root, run
docker compose up -dto start containers in daemon mode - Enter the container via
docker compose exec php bash(you are now in the root directory:/var/www) - Install Composer dependencies via
composer install - Run the tests:
bin/phpunit -c tests/
Running the Example
To set up and run example, follow these steps:
- go to the root directory of extensions
- download composer
- install dev libraries:
composer install - edit
example/em.phpand configure your database on top of the file - run:
php example/bin/consoleorphp example/bin/consolefor console commands - run:
php example/bin/console orm:schema-tool:createto create the schema - run:
php example/bin/console app:print-category-translation-treeto run the example to print the category translation tree
Contributors
Thanks to everyone participating in the development of these great Doctrine extensions!
And especially ones who create and maintain new extensions:
- Lukas Botsch lbotsch
- Gustavo Adrian comfortablynumb
- Boussekeyt Jules gordonslondon
- Kudryashov Konstantin everzet
- David Buchmann dbu
ttl/doctrine-extensions 适用场景与选型建议
ttl/doctrine-extensions 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 345 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 09 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「orm」 「tree」 「behaviors」 「extensions」 「gedmo」 「sluggable」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ttl/doctrine-extensions 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ttl/doctrine-extensions 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ttl/doctrine-extensions 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
jsTree widget for yii2
Kinikit - PHP Application development framework MVC component
PHP Database ORM for Symfony1. Do NOT use for new projects: please move to a newest Symfony release and Doctrine2
Doctrine2 behavior traits - slowhop fork
Doctrine2 behavior traits
A fast and dynamic Merkle tree implementation
统计信息
- 总下载量: 345
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 28
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-05