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

Param Converter Bundle Laravel Package

rollandrock/param-converter-bundle

A Symfony bundle that provides parameter converters for turning request data into objects or typed values with configurable conversion logic, helping keep controllers clean, reusable, and easier to test.

View on GitHub
Deep Wiki
Context7

Getting Started

Confirm the framework first. Despite the Laravel framing, this is a Symfony bundle — Bundle suffix, and "param converter" is a Symfony/SensioFrameworkExtraBundle concept (ParamConverterInterface, the request.param_converter service tag). If your stack is Laravel, this package is not applicable; the nearest equivalents are route model binding, Route::bind(), and FormRequests. Don't composer require it into a Laravel app — it will pull symfony/http-kernel and fight the framework for no benefit.

If you are on Symfony, the minimal path:

composer require rollandrock/param-converter-bundle
// config/bundles.php
return [
    // ...
    RollandRock\ParamConverterBundle\ParamConverterBundle::class => ['all' => true],
];

(Verify the exact FQCN and casing — with zero adopters, the README is the only source of truth.)

Where to look first, in order:

  1. composer.json in the repo — check require for symfony/framework-bundle, sensio/framework-extra-bundle, and the PHP/Symfony version constraints. This tells you whether the bundle targets an era of Symfony you actually run.
  2. src/ for classes implementing ParamConverterInterface, and a DependencyInjection/*Extension.php for the config tree.
  3. README.md for the tag names and service registration snippet.
  4. tests/ — if it's absent or thin, treat the package as read-before-use and budget time to write your own coverage.

The one command that matters after install:

bin/console debug:container --tag=request.param_converter

This lists every registered converter and its priority. If the tag is empty, the bundle installed but wired nothing (or wired to a different tag) — resolve that before writing a single line against it. Follow with:

bin/console config:dump-reference param_converter

First use case: a route parameter needs to become a typed object without boilerplate in the controller.

#[Route('/invoice/{invoice}', methods: ['GET'])]
public function show(Invoice $invoice): Response
{
    // $invoice is already resolved, or a 404 was thrown
}

Or the annotation style if the bundle targets older Symfony:

/**
 * @ParamConverter("invoice", class="App\Entity\Invoice")
 */

Implementation Patterns

  • One converter per target type. The idiomatic shape is a converter whose supports() returns true only for a specific class (entity, enum, UUID value object, DTO), with the resolution logic in apply(). Compose several small converters rather than one branching mega-converter — priority ordering is what arbitrates between them, and a monolith makes that ordering irrelevant-but-opaque.
  • Priority is the API. Converters are ordered by the priority attribute on the tag (default 0). The Doctrine ORM converter usually competes for entity classes; if you want your converter to intercept, give it a priority above the Doctrine one and confirm with debug:container.
  • Be explicit about the target class. Prefer naming the class on the param converter configuration rather than leaning on controller type-hint reflection. Reflection-based resolution degrades silently on nullable parameters, union types, and parameters with defaults.
  • Return false, don't throw, on "not mine." supports() should be cheap and side-effect free — it runs for every parameter of every controller. apply() should return false when the parameter is already an instance of the target, so the chain falls through cleanly to the next converter.
  • Separate 404 from 400. "Well-formed id, no row" is NotFoundHttpException. "Malformed id" is BadRequestHttpException or a validation failure. A converter that throws 404 on a malformed UUID hides client bugs behind a misleading status code and makes support tickets unreadable.
  • Conversion is not validation. Writing the object into $request->attributes does nothing about constraints. Follow with #[Assert]/Validator or #[MapRequestPayload]; don't assume the converter validated the input.
  • Query-string-to-DTO pattern. Read $request->query->all(), hydrate via constructor or the Serializer, $request->attributes->set($param, $dto), return true. Keep the hydration strict — unknown keys should error, not be silently dropped.
  • Test three cases per converter. Happy path; unsupported type (must return false without exploding); not-found. Those are the failure modes that otherwise only surface in production.

Workflow: inventory the tag → write one controller action and assert resolution → hit the route with a deliberately bad id to confirm the status code is the one you intended.

Gotchas and Tips

  • Zero adoption signals. 0 stars, 0 dependents. Treat every README claim as unverified against your Symfony version. Pin the exact version (or a commit hash) in composer.json, and add a smoke test that exercises the converter so an upstream drift fails CI instead of production.
  • Release date anomaly. The listed last release (2026-10-26) is in the future relative to a normal timeline — usually a re-tagged commit, a Packagist metadata artifact, or a scrape error. Run composer show -a rollandrock/param-converter-bundle and check the tag history before trusting any constraint.
  • SensioFrameworkExtraBundle is dead weight on modern Symfony. 6.2+ moved to argument resolvers, and 7.x drops the bundle. If these converters implement ParamConverterInterface, they may not auto-convert at all on a current install. Check with composer why sensio/framework-extra-bundle before debugging your own code.
  • Wrong tag = silent no-op. The correct tag in the legacy system is request.param_converter. A bundle wired to a slightly different tag installs cleanly and does absolutely nothing. This is the single most common "it doesn't work" cause with param converters.
  • Ordering bugs are silent. Two converters both returning true means the higher priority wins and the other never runs — no error, no log. Inspect with debug:container --tag=request.param_converter --show-private.
  • Stale container cache. Tags are compiled. After changing converter services or tags, bin/console cache:clear; a stale cache produces "class not found" or mysteriously missing converters that look like bugs in the package.
  • Debugging: dump $request->attributes->all() at the top of the controller to see whether the converter ran at all; the profiler's request panel shows the kernel.controller listener chain and where in it the conversion happens.
  • Extension point: the better escape hatch is usually writing your own ParamConverterInterface implementation in app code (or an ArgumentResolver on 6.2+) rather than forking this bundle. The interface is tiny, app-local converters are trivially testable, and you avoid owning a dependency with no maintainer signal. Fork only if you specifically need this bundle's converter semantics and can't reproduce them in ~40 lines.
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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle