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

Routing Laravel Package

nette/routing

Nette Routing is a standalone two-way router for PHP that maps SEO-friendly URLs to presenter/action pairs and back. It supports route masks, parameters, localization, and is used by the Nette Framework.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. nette/routing is a standalone, framework-agnostic two-way URL converter: Router::match(IRequest): ?array and Router::constructUrl(array, UrlScript): ?string. Laravel’s router is a different architectural layer: it is bound to the HTTP kernel, middleware pipeline, controller resolution, route model binding, CSRF/session/auth middleware, signed URLs, localization, route caching, and the route() helper. Nette routing does not replace any of that. For a Laravel product, fit is poor for primary routing and moderate only for bounded scenarios: a Nette-to-Laravel migration bridge, a standalone URL-generation/matching service outside the Laravel kernel, or a compatibility layer for legacy route definitions. It should not be positioned as a drop-in Laravel router.

Integration feasibility. Technically feasible but adapter-heavy. You would need to map Illuminate\Http\Request to Nette\Http\Request (URL, method, headers, body/files), call route matching, then re-enter Laravel’s dispatch path with matched parameters. Outbound URL generation would need to go through constructUrl() with a reference URL, which means Laravel’s route()/url() helpers and signed URL generation would be bypassed unless wrapped. Route definition syntax also differs (<id> vs {id}, constraint syntax, defaults, flags), so either Nette or Laravel must be the single source of truth — maintaining both is a defect factory. Middleware, authorization, and route model binding do not automatically apply to a Nette match, which is a security and correctness boundary.

Technical risk. Key risks are: (1) license metadata is NOASSERTION; legal must confirm the actual license before adoption; (2) the v3.1 line requires PHP 8.1+ and the package has moved to PHP 8.2-oriented support, constraining older Laravel estates; (3) low external dependents in the provided data means limited community proof and fewer Laravel-specific integration examples; (4) dual routing creates two URL truths and drift between inbound matching and outbound generation; (5) regex constraints and route ordering are operationally fragile at scale; (6) matching before Laravel middleware can bypass auth/CSRF assumptions if not carefully sequenced. Release cadence is healthy — static analysis cleanup, PHP 8.5 support, and RFC 3986 param2path() handling in 3.1.1 — but activity is not the same as Laravel fit.

Key questions.

  • What is the legally confirmed license and redistribution obligation?
  • Is this replacing Laravel routing, or only bridging legacy Nette routes or generating URLs in a bounded service?
  • Who owns the adapter and the route-parity test suite?
  • Can we accept bypassing Laravel middleware, route model binding, and route() helpers for the affected endpoints?
  • What is the rollback plan if Nette matching diverges from Laravel behavior in production?
  • What are the expected route counts, regex complexity, localization requirements, and signed-URL requirements?
  • Is there a supported upgrade path if Nette routing changes its API?

Recommendation. Do not adopt nette/routing as the primary router for a Laravel application. Approve a time-boxed proof of concept only for a clearly bounded bridge or URL service, with a written exit strategy and route-parity tests. Treat core-routing replacement as a high-risk architectural change with low expected payoff.

Integration Approach

Stack fit. Assume Laravel 10/11/12, PHP 8.2+, Composer. Add nette/routing and its nette/http/nette/utils dependencies in a dedicated integration module, not in app/Providers/RouteServiceProvider.php. Keep Laravel’s router as the default dispatcher. The package should sit behind an interface such as LegacyRouteMatcher or CanonicalUrlBuilder, so application code does not depend on Nette types directly.

Migration path. Start with an inventory: list routes that are legacy Nette patterns, routes that need two-way conversion, and routes that must remain native Laravel. Build a thin adapter that (a) converts Illuminate\Http\Request to Nette\Http\Request, (b) calls RouteList::match(), (c) maps matched parameters into a Laravel dispatch target (controller/action or a named route with parameters), and (d) exposes constructUrl() through a wrapper used only by legacy-aware code. For a migration, run Nette matching in shadow mode first: log the Nette result alongside Laravel’s result without changing responses. Compare matched route, parameters, and generated URLs. Cut over one route group at a time, not the whole application.

Compatibility. Expect pattern and semantic differences: parameter syntax, optional/default segments, regex constraints, trailing-slash handling (RouteList::withPath() treats trailing slash as optional since 3.0.5), domain scoping, and RFC 3986 encoding behavior. Since 3.1.1, param2path() handles all RFC 3986 characters; do not pre-encode values passed to constructUrl(), or you will double-encode. HTTP method handling, middleware, and auth must remain in Laravel or be explicitly implemented in the adapter. If the team is on PHP 8.0/8.1, v3.1+ is not viable; older major versions are a different risk profile and should be evaluated separately.

Sequencing.

  1. Legal and dependency review: confirm license, pin versions, check transitive dependencies.
  2. Spike: one legacy route group, one inbound match, one outbound URL generation, one middleware-sensitive endpoint.
  3. Parity harness: table-driven tests for match/no-match, parameter defaults, constraints, encoding, trailing slash, and URL round-trips.
  4. Shadow deployment: compare Nette and Laravel results in logs with zero user impact.
  5. Limited production: feature-flag the bridge for a non-critical route group; define rollback by disabling the flag.
  6. Decision gate: expand only if parity, latency, and operational ownership are proven; otherwise retire the integration.

Do not attempt a “big bang” replacement of Laravel’s router. Do not let two route definition files become independently edited sources of truth; generate one from the other or restrict Nette to read-only legacy definitions.

Operational Impact

Maintenance. The integration adds a dependency, an adapter layer, and a parity test suite to the maintenance surface. Nette routing itself is small and actively maintained, with recent releases focused on static analysis and PHP version support. The operational burden is not the package; it is the adapter and the dual-routing model. Assign a named owner and budget recurring time for dependency upgrades, PHP version bumps, and route-parity regressions. Pin minor versions and review release notes before upgrades.

Support. There is no commercial SLA implied by the package; support is community/maintainer-driven. Low external dependents in the provided data means fewer public Laravel integration patterns and less Stack Overflow coverage. Internal documentation, a runbook, and contract tests are mandatory. If the route layer is business-critical, the lack of a vendor support contract is a material risk.

Scaling. Routing is in-process and CPU-bound; it will not be the throughput bottleneck at normal request volumes. The scaling risks are route-count growth, regex backtracking in complex constraints, and repeated route-list construction if not cached or container-managed. URL generation is stateless and cheap. Cache compiled route definitions where possible; benchmark with production-like route counts and pathological URLs.

Failure modes. Watch for: order-dependent matching causing the wrong route to win; 404s from trailing-slash or encoding mismatches; double-encoded URLs from pre-encoding parameters; middleware/auth bypass when Nette matches before Laravel’s pipeline; route model binding not firing; route() helper drift because URLs are generated by a different subsystem; default parameter values that are not stringable; and silent divergence between shadow-mode results and production behavior. Add structured logs for matched route name, parameters, latency, and unmatched URL patterns; alert on parity mismatches and 5xx spikes after cutover.

Ramp-up. Laravel developers will need one to two days to learn Nette’s route syntax, matching order, constraints, and URL generation semantics, plus additional time for the adapter and dispatch model. The package documentation is decent but Nette-oriented; it does not teach Laravel integration. Produce an internal one-page guide, annotated examples, and a test template. Expect the highest ramp-up cost to be in middleware/auth interactions and URL-generation consistency, not in basic route matching.

Bottom line for operations. This is supportable only as a bounded, owned, tested bridge. As a core Laravel routing replacement, it increases operational surface without enough compensating benefit.

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.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
adachsoft/php-code-style