vitexsoftware/ease-doctrine
Composer 安装命令:
composer require vitexsoftware/ease-doctrine
包简介
FluentPDO-like API powered by DoctrineORM for easy migration.
README 文档
README
A drop-in replacement for FluentPDO, powered by DoctrineORM. This library allows you to migrate existing applications from FluentPDO to DoctrineORM with minimal code changes.
Features
- FluentPDO-like API for easy migration
- Internally uses DoctrineORM for database operations
- Supports multiple database platforms (as supported by DoctrineORM)
- Complete CRUD operations with FluentPDO-compatible methods:
- getColumnsFromSQL(): Fetch specific columns with conditions
- getDataFromSQL(): Load records by ID
- loadFromSQL(): Load data with conditions
- saveToSQL(): Insert or update records
- deleteFromSQL(): Remove records
- recordExists(): Check record existence
- Query builder and transaction support
- Table and column property compatibility (myTable, keyColumn, nameColumn, etc.)
- Compatible with PHP 8.4+
- PSR-12 compliant
- Secure, extensible, and well-tested
Installation
composer require vitexsoftware/ease-doctrineorm
Usage Example
use Ease\Doctrine\Engine; $connectionParams = [ 'driver' => 'pdo_sqlite', 'path' => __DIR__ . '/var/data.sqlite', ]; $config = [ 'entityPath' => __DIR__ . '/src/Entity', 'devMode' => true, ]; $easeDoctrine = new Engine($connectionParams, $config); $easeDoctrine->setmyTable('User'); $easeDoctrine->keyColumn = 'id'; $easeDoctrine->nameColumn = 'username'; // Basic operations $allUsers = $easeDoctrine->getAll(); $userName = $easeDoctrine->getRecordName(); // FluentPDO-compatible operations // Load specific columns with conditions $users = $easeDoctrine->getColumnsFromSQL( ['username', 'email'], ['active' => true], 'username', null, 10 ); // Load by ID $user = $easeDoctrine->getDataFromSQL(123); // Save (insert or update) $userData = ['username' => 'john_doe', 'email' => 'john@example.com']; $userId = $easeDoctrine->saveToSQL($userData); // Check existence if ($easeDoctrine->recordExists('john_doe')) { echo 'User exists!'; } // Delete $easeDoctrine->deleteFromSQL(['id' => 123]); // Load with conditions $activeUsers = $easeDoctrine->loadFromSQL(['active' => true]);
Detailed API Documentation
The library provides several FluentPDO-compatible methods for database operations:
getColumnsFromSQL(array $columnsList, $conditions = null, $orderBy = null, $indexBy = null, $limit = null)- Fetch specific columns with conditions, ordering, and limits.
getDataFromSQL($itemID, array $columnsList = ['*'])- Load a record by its ID, optionally selecting specific columns.
loadFromSQL($itemID)- Load data for specified conditions or ID.
saveToSQL($data = null)- Save (insert or update) data to the database.
updateToSQL($data = null, $conditions = [])- Update existing records matching conditions.
insertToSQL($data = null)- Insert a new record.
deleteFromSQL($data = null)- Delete records matching conditions.
recordExists($data)- Check if a record exists. Can check by ID, name, or conditions.
dbreload()- Reload current record from database.
dbsync(array $data = [])- Save data and reload from database.
Testing
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests
License
MIT License
Author
Vitex Software <info@vitexsoftware.cz>
vitexsoftware/ease-doctrine 适用场景与选型建议
vitexsoftware/ease-doctrine 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 10 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 vitexsoftware/ease-doctrine 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vitexsoftware/ease-doctrine 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-10