andreybolonin / modernorm-bundle
Symfony integration and Profiler for ModernORM, the PostgreSQL-first ORM.
Package info
github.com/andreybolonin/modernormbundle
Type:symfony-bundle
pkg:composer/andreybolonin/modernorm-bundle
Requires
- php: ^8.4
- andreybolonin/modernorm: ^0.1.0-beta.5 || ^1.0.0-rc.1
- doctrine/dbal: ^4.6
- symfony/cache: ^7.4 || ^8.0
- symfony/console: ^7.4 || ^8.0
- symfony/framework-bundle: ^7.4 || ^8.0
- symfony/service-contracts: ^3.5
- symfony/yaml: ^7.4 || ^8.0
Requires (Dev)
- doctrine/data-fixtures: ^2.2
- doctrine/migrations: ^3.9.1
- friendsofphp/php-cs-fixer: ^3.90
- open-telemetry/api: ^1.11
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
- symfony/messenger: ^7.4 || ^8.0
- symfony/twig-bundle: ^7.4 || ^8.0
- symfony/web-profiler-bundle: ^7.4 || ^8.0
Suggests
- doctrine/data-fixtures: Enables optional fixture loading.
- doctrine/migrations: ^3.9.1 enables optional ModernORM migration commands.
- open-telemetry/api: Records ModernORM operation metrics with the optional OpenTelemetry adapter; configure a MeterProvider in your application.
- symfony/twig-bundle: Renders the ModernORM Profiler panel.
- symfony/web-profiler-bundle: Displays ModernORM metrics in the Symfony toolbar and Profiler.
Provides
None
Conflicts
- doctrine/data-fixtures: <2.2 || >=3.0
- doctrine/migrations: <3.9.1 || >=4.0
Replaces
None
This package is auto-updated.
Last update: 2026-11-24 16:04:51 UTC
README
Generate entities from an existing PostgreSQL or MySQL database with
modernorm:mapping:import, including a dry-run preview.
Plan a MySQL → PostgreSQL data migration with
modernorm:data:transfer --dry-run. The first version
checks structure and dependencies; add --validate-data to scan all source rows
for value compatibility. Use --rehearsal to load and verify a separate disposable
PostgreSQL database with real constraints and triggers.
Use --rules=rules.json for explicit shared transformations and --change-log
for a streaming audit of changed PKs.
--dry-run --suggest-rules offers an interactive selection of rules, saves a new
reviewed JSON file and revalidates it without loading data.
Use --execute for the final transfer to the explicitly selected empty PostgreSQL
target after stopping source writes. Application cutover remains a separate step.
Use --schema-rekey for a full transfer that replaces
composite entity PKs with BIGINT IDs and remaps FK/ManyToMany links through staging.
Optional saved plans bind the schemas, endpoints and shared transformation rules;
without a plan file, the command builds and checks the plan in memory.
Find expensive ORM work in Symfony. Follow it from the Profiler to Grafana.
ModernORMBundle brings ModernORM, the PostgreSQL-first ORM for PHP 8.4+, into Symfony with a Performance Advisor, request-level diagnostics and OpenTelemetry metrics.
Documentation · Monitoring demo · CI · Changelog
What you get
| Feature | What it helps you do |
|---|---|
| Performance Advisor | Investigate repeated SQL, slow queries, frequent flushes, costly hydration and one-item batches using measured evidence and links to the relevant panel. |
| Symfony Profiler | Explore eight saved-profile tabs: Overview, Queries, UnitOfWork, Hydration, Batch Fetching, L2 Cache, Bulk Operations and PostgreSQL. |
| OpenTelemetry / OTLP export | Export SQL/DML/flush/batch/bulk timings, hydration and global L2 activity through the application's MeterProvider and OTLP exporter. |
| Grafana dashboard + VictoriaMetrics | Start a runnable Collector → VictoriaMetrics → Grafana example with fourteen provisioned panels for rates, latency, batching and cache reuse. |
| Batch and L2 visibility | See association groups, selected batch sizes, fallback decisions and entity-cache hits, misses, puts and invalidations. |
| Symfony services and workers | Inject the EntityManager, DBAL connection and Statistics; reset ORM state between requests and Messenger jobs. |
| Migrations and fixtures | Use dedicated console commands, schema ownership filters, constructor-injected fixtures, groups and references. |
The monitoring stack is opt-in and ships as a runnable prototype. Explore the Profiler gallery and measurement notes →
Quick start
Requires PHP 8.4+, PostgreSQL and Symfony 7.4 or 8.x. Add TwigBundle and WebProfilerBundle for the optional debug UI.
composer require 'andreybolonin/modernorm:^0.1.0-beta.5' 'andreybolonin/modernorm-bundle:^0.1.0-beta.6'
See the core 1.0 release candidate guide for the published RC pair, tested candidate revisions and upgrade steps.
Register the bundle in config/bundles.php:
ModernORM\Bundle\ModernORMBundle::class => ['all' => true],
Configure your connection and entity directory:
# config/packages/modernorm.yaml modernorm: url: '%env(resolve:DATABASE_URL)%' mapping_paths: - '%kernel.project_dir%/src/Entity' batch_size: 32 profiler: collect_sql: '%kernel.debug%'
Inject ModernORM\EntityManagerInterface into your services. With Symfony's WebProfiler enabled and its standard routes imported, the ModernORM panel is registered automatically.
Full installation, cache configuration and service aliases →
Take the metrics to Grafana
The included example connects real ORM workloads to a local monitoring stack:
ModernORM → OpenTelemetry PHP SDK → OTLP/HTTP → Collector → VictoriaMetrics → Grafana
Follow SQL and bulk activity, latency histograms, hydration, batch sizes and L2 hit ratio across HTTP processes and workers. The Collector also exposes a Prometheus-compatible endpoint.
Run the monitoring stack → · Adapters and worker lifecycle →
Go deeper
Profiler and Advisor settings · Migrations · Fixtures · Tests and compatibility · All documentation
MIT licensed. Contributions and security reports are welcome.
