mmx/database
Composer 安装命令:
composer require mmx/database
包简介
Eloquent for MODX 3
README 文档
README
This extra is part of MMX initiative - the Modern MODX approach.
Prepare
This package can be installed only with Composer.
If you are still not using Composer with MODX 3, just download the composer.json of your version:
cd /to/modx/root/
wget https://raw.githubusercontent.com/modxcms/revolution/v3.0.4-pl/composer.json
Then run composer update --no-dev and you are ready to install the mmx packages.
Install
composer require mmx/database --update-no-dev
composer exec mmx-database install
Remove
composer exec mmx-database remove
composer remove mmx/database
How to use
mmxDatabase service will be registered globally, so you can use its models anywhere in your PHP code inside MODX.
Get all published resources with Template and TV values.
$resources = \MMX\Database\Models\Resource::query() ->with('Template:id,templatename') ->with('TvValues') ->where('published', true) ->get(); foreach ($resources as $resource) { print_r($resource->toArray()); }
Get categories with relations:
$categories = \MMX\Database\Models\Category::query() ->with('Templates') ->with('Plugins') ->with('Snippets') ->with('Chunks') ->with('Tvs') ->get(); foreach ($categories as $category) { print_r($category->toArray()); }
You can see all currently available models with their relations in Models directory.
Do not forget to read the official Eloquent documentation.
Nota bene!
mmxDatabase models are not contain any MODX related logic, like clearing cache or calling plugin events.
This is just a convenient way to work with MODX database directly, without xPDO.
Project is still under development, do not hesitate to use issues if you have any.
mmx/database 适用场景与选型建议
mmx/database 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 910 次下载、GitHub Stars 达 5, 最近一次更新时间为 2024 年 03 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mmx/database 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mmx/database 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 910
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 13
- 依赖项目数: 6
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-14