ecommit/doctrine-utils
Small set of Doctrine ORM QueryBuilder utilities: accurate COUNT helpers, a paginator, and filter helper methods. Install via Composer and use to simplify common query building patterns in your PHP projects.
doctrine/dbal or doctrine/orm packages), integration is straightforward if the project already uses Doctrine.composer require installation with no breaking changes expected.| Risk Area | Assessment | Mitigation Strategy |
|---|---|---|
| Dependency Conflicts | Low (MIT license, no major Doctrine version constraints). | Check composer.json for Doctrine version compatibility. |
| Performance Overhead | Minimal (optimized for QueryBuilder). | Benchmark against native Laravel/Eloquent pagination. |
| Maintenance Burden | Low (active GitHub workflows, MIT license). | Monitor for updates; fork if needed. |
| API Stability | Medium (undocumented API, no dependents). | Treat as experimental; wrap usage in a service layer for isolation. |
| Laravel-Specific Gaps | No Laravel-specific features (e.g., no integration with Eloquent). | Use only for Doctrine-based queries; avoid mixing with Eloquent where possible. |
cursor() pagination).Paginator/LengthAwarePaginator be gradually replaced?by_identifier usage.// Before (Eloquent)
$count = User::query()->count();
$users = User::paginate(10);
// After (DoctrineUtils)
$queryBuilder = $entityManager->getRepository(User::class)->createQueryBuilder('u');
$count = DoctrinePaginatorBuilder::countQueryBuilder(['query_builder' => $queryBuilder]);
$paginator = new DoctrineORMPaginator(['query_builder' => $queryBuilder, 'page' => 1, 'max_per_page' => 10]);
| Component | Compatibility Notes |
|---|---|
| Doctrine ORM/DBAL | ✅ Full support (tested in README). |
| Laravel Eloquent | ❌ No direct integration (requires QueryBuilder bridge). |
| Laravel Paginator | ⚠️ Can replace but requires manual adaptation (e.g., wrapping results in LengthAwarePaginator). |
| Custom Repositories | ✅ Ideal fit for Doctrine-based repositories. |
| API Routes | ⚠️ May need middleware to handle paginator responses (e.g., JSON formatting). |
by_identifier logic).QueryBuilderFilter aligns with project needs).cursor() or simplePaginate()).by_identifier for ID-based fetching).count_by_sub_request may improve performance for complex queries).cursor() for memory efficiency.by_identifier with large IN clauses).| Scenario | Risk Level | Impact | Mitigation |
|---|---|---|---|
| Doctrine version mismatch | Medium | Integration breaks. | Pin Doctrine versions in composer.json. |
SQL injection in by_identifier |
High | Security vulnerability. | Validate/sanitize identifiers; avoid dynamic SQL. |
| Performance degradation | Medium | Slow queries. | Use count_by_sub_request for complex counts; avoid DISTINCT unnecessarily. |
| Package abandonment | Low | No updates. | Fork and maintain; limit critical dependencies. |
| Laravel version conflicts | Low | Dependency hell. | Use Laravel’s built-in Doctrine packages (doctrine/dbal via laravel-doctrine). |
doctrine/orm, doctrine/dbal).How can I help you explore Laravel packages today?