kleijnweb/php-api-routing-bundle
Laravel-friendly bundle for building API routing with a structured approach. Helps organize route definitions, controllers, and versioned endpoints into a cleaner setup for small to medium PHP APIs.
Illuminate\Routing) is fundamentally different from Symfony’s RoutingBundle. Direct integration would require significant abstraction or middleware layering.darkaonline/l5-swagger or zircote/swagger-php. This bundle’s Symfony-centric design may not align with Laravel’s ecosystem.Router class) and Symfony’s RoutingBundle are incompatible without a bridge. Potential workarounds:
symfony/http-kernel) as a Laravel middleware.RoutingBundle relies on symfony/routing, symfony/http-foundation, etc., which may conflict with Laravel’s autoloader or service container.zircote/swagger-php) already generate OpenAPI specs from annotations/routes. This bundle offers no unique advantage.Why Symfony Routing?
spatie/laravel-api) achieve the same goal with lower risk?Migration Path
OpenAPI Requirements
sensio/framework-extra-bundle for annotations? If so, could zircote/swagger-php or darkaonline/l5-swagger suffice?Long-Term Viability
RoutingBundle is tightly coupled to Symfony’s HttpKernel and EventDispatcher.darkaonline/l5-swagger for OpenAPI + custom route attributes.// app/Http/Middleware/SymfonyRouter.php
public function handle($request, Closure $next) {
$symfonyRequest = SymfonyRequest::createFromGlobals();
$symfonyKernel = new SymfonyKernel('prod', false);
$response = $symfonyKernel->handle($symfonyRequest);
return new SymfonyResponse($response);
}
routes/web.php or routes/api.php._format parameter for API versioning would require custom Laravel middleware.@SWG\* annotations (from nelmio/api-doc-bundle) have no direct Laravel equivalent. Use zircote/swagger-php annotations instead:
/**
* @OA\Get(
* path="/users",
* summary="Get users"
* )
*/
public function index() { ... }
replace or conflict directives or use a separate vendor directory for Symfony dependencies.symfony_route: { path: "/api/users", defaults: { _controller: "App\Controller\UserController::index" } } to:
Route::get('/api/users', [UserController::class, 'index']);
nelmio/api-doc-bundle with darkaonline/l5-swagger or zircote/swagger-php.// Convert Symfony's security firewall to Laravel middleware
public function handle($request, Closure $next) {
if (!$request->user()) {
abort(401);
}
return $next($request);
}
RoutingBundle and related packages (e.g., symfony/http-kernel) may introduce unnecessary dependencies.php artisan route:list won’t reflect Symfony routes without custom logic.HttpKernel consumes more memory than Laravel’s router. Monitor in production._locale parameter vs. Laravel’s locale() helper.symfony/http-foundation expects Symfony’s Request object, not Laravel’s.RoutingBundle and Laravel’s router.How can I help you explore Laravel packages today?