Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Object Routing Bundle Laravel Package

webfactory/object-routing-bundle

Symfony bundle for object-oriented routing: map request parameters to domain objects and generate URLs directly from objects via configurable route providers, keeping controllers thin and URL logic reusable.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit — the central problem. webfactory/object-routing-bundle is a Symfony bundle, not a Laravel package. It registers via bundles.php, boots through Symfony\Component\HttpKernel\Bundle\Bundle, wires services through a DI Extension and compiler passes, and decorates Symfony's UrlGeneratorInterface. None of that lifecycle exists in Laravel. Laravel's Illuminate\Routing\UrlGenerator, its named-route registry, and route model binding solve roughly 80% of the same problem space — inbound binding in particular — so the delta we would actually be buying is the outbound case: generating a URL from an arbitrary domain object without the caller knowing the route name or parameter shape.

That said, the underlying value proposition is real and Laravel has no first-class equivalent. Today most Laravel codebases hardcode route('orders.show', $order) at every call site; the object-routing pattern centralizes that mapping so a route rename is a one-line registry change rather than a grep-and-replace across views, mailers, notifications, and API resources.

Integration feasibility — low as-is, moderate as a port. composer require webfactory/object-routing-bundle into a Laravel app would pull Symfony HttpKernel/DI/Routing (some already transitively present via Laravel), but the bundle would never boot. Out-of-the-box feasibility is effectively zero. Two realistic paths:

  1. Symfony-tier only — if the org runs Symfony services alongside Laravel, adopt it there and leave Laravel untouched.
  2. Port the core — depend on the framework-agnostic webfactory/object-routing library and write a thin Laravel adapter (service provider, tagged-iterator registry of generators, a ObjectRouter binding, a object_route() helper). Estimated 200–400 LOC plus tests — a spike, not a project.

Technical risk. Stars (0) and dependents (0) are the headline risk: no production evidence, no community, single-vendor bus factor. The project is a fork of benjam1/object-routing-bundle, which is itself dormant, so inherited code paths should be audited rather than trusted. Recent release activity (2025-12-15) is a positive signal but not a substitute for adoption. Secondary risks: Symfony major-version coupling in the bundle layer, PSR-7/PSR-17 bridging overhead if the core returns URI objects rather than strings, and logic buried in compiler passes that will not survive the port.

Key questions for the maintainer spike:

  • Does the core library expose a clean RouteGenerator/ObjectRouter seam with no Symfony type hints in its public API?
  • Are generated URLs plain strings or PSR-7 UriInterface? If the latter, what is the cost of bridging into Laravel's string-based generator?
  • How is the object→route map declared (compiler-pass tags vs. runtime registration), and can it be reproduced with Laravel's container tagging?
  • Support for locale, versioned APIs, multi-domain/tenant contexts?
  • Stated PHP and Symfony version constraints, and the tested matrix?
  • Is the fork's divergence from benjam1 documented, and are inherited deprecations cleared?

Integration Approach

Stack fit. Target Laravel 10–12 on PHP 8.2+. Before committing, read the core library's composer.json require block — if it hard-depends on symfony/routing contracts, the port cost rises materially because we would need to satisfy interfaces Laravel does not implement. If it depends only on PSR interfaces, the adapter is straightforward.

Compatibility. Verify against the current Symfony LTS and the latest major, plus PHP 8.2/8.3/8.4. Confirm the bundle does not rely on deprecated Extension::load() signatures or removed compiler-pass APIs. For the Laravel adapter, pin the core library to a minor range and lock it in composer.lock.

Migration path. Do not attempt a big-bang replacement of named routes. Introduce the object router alongside existing route() calls, adopt it in one bounded surface first (transactional email templates are the ideal pilot — high call-site density, low blast radius, easy rollback to named routes), then expand to API resources and redirects. Existing named routes remain the fallback path indefinitely.

Sequencing.

  1. Spike (3–5 days) — install the core library in a scratch Laravel app, drive ObjectRouter directly with hand-written generators, prove URL output matches current routes byte-for-byte.
  2. Adapter build (1–2 sprints) — service provider, registry, helper/facade, config file for the class→generator map, and a test suite covering unmapped objects, locale switching, and nested resource parameters.
  3. Pilot — one mailer/notification surface, feature-flagged.
  4. Observability — log every resolution miss with the object class so gaps surface before users hit them.
  5. Expansion — API resources, canonical/SEO URLs, then sitemap generation, which is where the pattern pays for itself most visibly.

If step 1 reveals heavy Symfony coupling in the core, fall back to implementing the pattern natively (~1 sprint) rather than fighting the dependency.

Operational Impact

Maintenance. The adapter is ours to own forever. Upstream is single-vendor, zero-adoption OSS; treat it as a vendored dependency rather than a supported library. Budget a recurring line item for version bumps and periodic audits. Keep the adapter thin — every line of Symfony-flavored glue ported into it is a line that will rot when Symfony majors move.

Support. No SLA, no vendor, no Stack Overflow corpus. Support means GitHub issues and reading source. Require an internal runbook documenting the class→route map, how to add a generator, and how to fall back to route() when something breaks in production. Designate one engineer as owner; the failure mode of "nobody understands the routing layer" is worse than hardcoded route names.

Scaling. Resolution itself is cheap — an in-memory class map plus a generator call, O(1) per object. The real cost is (a) constructing large object graphs just to build URLs, and (b) resolving in tight loops (feeds, sitemaps, list endpoints). Mitigate with per-request memoization and by making generators accept identifiers rather than fully hydrated models where possible. For sitemaps and bulk exports, build the route map once at deploy and cache it; do not let the registry be rebuilt per item.

Failure modes to instrument for:

  • Unmapped object — throws at render time, typically inside a queued mailer where it is silent until retry exhaustion. Must log class + context and fail loudly.
  • Stale map after refactor — a route renamed but the generator not updated; produces 404s in emails and external links that analytics will not catch for days. Add a test asserting every registered generator produces a URL that resolves.
  • Context mismatch — multi-tenant or multi-domain apps where the generated host is wrong because the request context differs from the render context (queue workers, CLI sitemap generation). This is the highest-probability production incident and needs explicit tests.
  • Upstream breaking change — pin and vendor.

Ramp-up. A mid-level Laravel developer unfamiliar with Symfony's DI needs roughly 2–3 days to read the bundle, 1–2 sprints to ship a tested adapter. Broader team education is a single brown-bag session plus the runbook. Expect some resistance: the pattern is idiomatic in Symfony and novel in Laravel, and reviewers will reasonably ask why route('orders.show', $order) is insufficient. Have the answer ready — route-name churn, cross-surface consistency, and sitemap generation are the strongest arguments, and they should be demonstrated on the pilot, not asserted in a design doc.

Recommendation. Worth a spike, not worth an unconditional commitment. The concept is valuable; the artifact is a Symfony bundle with zero adoption. Approve only with a hard gate at the end of step 1 and an explicit willingness to build the pattern natively if the core library proves entangled.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource