alexlisenkov/uuid-argument-resolver-bundle
/{uuid}). This aligns with RESTful API design patterns where UUIDs are commonly used as resource identifiers.UuidInterface dependencies, reducing boilerplate for UUID parsing/validation in controllers.findOneByUuid() in repositories).ResponseInterface for invalid UUIDs).composer require + bundle enablement).ramsey/uuid (v4.1+), which must be compatible with your project’s UUID generation/validation needs (e.g., version 4 vs. version 7).ramsey/uuid updates.nyholm/psr7 or symfony/psr-http-message-bridge).ramsey/uuid (v4.1+) for UUID generation/validation? If not, will this introduce inconsistencies?400 Bad Request responses acceptable, or do you need custom logic (e.g., API problem details, localization)?ramsey/uuid is optimized but may not match native PHP UUID parsing.)sensio/framework-extra-bundle) or API Platform’s UUID resolver achieve the same goal with lower risk?nelmio/api-doc-bundle for UUIDs in OpenAPI) or contribute to this bundle?Uuid types).composer require alexlisenkov/uuid-argument-resolver-bundle ramsey/uuid
config/bundles.php:
return [
// ...
AlexLisenkov\UuidArgumentResolverBundle\UuidArgumentResolverBundle::class => ['all' => true],
];
UuidInterface (e.g., @Route("/resources/{uuid}")).
Example:
use Ramsey\Uuid\UuidInterface;
class ResourceController {
public function show(UuidInterface $uuid): Response { ... }
}
Resource classes.UuidInterface.doctrine/doctrine-bundle if using UUID fields in entities.ext-intl may be needed for UUID validation in some ramsey/uuid configurations.Uuid::fromString() calls).UuidInterface types.Uuid::fromString($request->get('uuid'))).ramsey/uuid and Symfony-specific components to the stack.sensio/framework-extra-bundle).ramsey/uuid is optimized, but validation adds ~1–5ms per request (benchmark in your stack).findOneByUuid), ensure your database supports efficient UUID indexing (e.g., PostgreSQL UUID type, MySQL BINARY(16)).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Invalid UUID in request | 400 Bad Request (configurable) |
Custom error responses (e.g., API problem details) or fallback to string UUID. |
| Symfony version incompatibility | Bundle fails to load | Pin Symfony dependencies or fork the bundle. |
ramsey/uuid security vulnerability |
Potential RCE or data corruption | Monitor for updates; consider pinning ramsey/uuid to a specific patch version. |
| Missing UUID in route | 404 Not Found (Symfony default) |
Ensure route constraints (e.g., @Route("/{uuid}", requirements={"uuid": ".+"})). |
| Custom response factory mis |
How can I help you explore Laravel packages today?