singleton(PathProvider::class, $pathProvider); // Bootstrap discovery service $discoveryBootstrapper = new DiscoveryServiceBootstrapper(); $discoveryBootstrapper->initialize($container); // Get the discovery registry $discoveryRegistry = $container->resolve(DiscoveryRegistry::class); echo "Discovery Registry successfully loaded\n"; // Check total Route attributes discovered $routeCount = $discoveryRegistry->attributes->getCount(Route::class); echo "Total Route attributes found: $routeCount\n\n"; if ($routeCount > 0) { $routes = $discoveryRegistry->attributes->get(Route::class); echo "=== Searching for ShowImage Route ===\n"; // Search specifically for ShowImage $showImageRoutes = array_filter($routes, function ($route) { return str_contains($route->filePath->normalized ?? '', 'ShowImage.php'); }); echo "ShowImage routes found: " . count($showImageRoutes) . "\n"; if (count($showImageRoutes) > 0) { foreach ($showImageRoutes as $route) { echo "*** FOUND ShowImage route! ***\n"; echo " Path: " . ($route->additionalData['path'] ?? 'unknown') . "\n"; echo " Method: " . ($route->additionalData['http_method'] ?? 'unknown') . "\n"; echo " Class: " . ($route->additionalData['class'] ?? 'unknown') . "\n"; echo " File: " . ($route->filePath->normalized ?? 'unknown') . "\n"; } } else { echo "❌ ShowImage route NOT found in discovery\n"; // Let's look at a few sample routes to understand the pattern echo "\n=== Sample Routes for Debugging ===\n"; foreach (array_slice($routes, 0, 5) as $index => $route) { echo "Route " . ($index + 1) . ":\n"; echo " File: " . ($route->filePath->normalized ?? 'unknown') . "\n"; echo " Class: " . ($route->additionalData['class'] ?? 'unknown') . "\n"; echo " Path: " . ($route->additionalData['path'] ?? 'unknown') . "\n"; echo "\n"; } // Look for files in Application/Media directory echo "=== Looking for files in Application/Media ===\n"; $mediaRoutes = array_filter($routes, function ($route) { return str_contains($route->filePath->normalized ?? '', 'Application/Media'); }); echo "Routes in Application/Media: " . count($mediaRoutes) . "\n"; foreach ($mediaRoutes as $route) { echo " File: " . ($route->filePath->normalized ?? 'unknown') . "\n"; echo " Class: " . ($route->additionalData['class'] ?? 'unknown') . "\n"; } } } else { echo "❌ No routes found in discovery registry!\n"; } } catch (Exception $e) { echo "❌ Error during discovery test: " . $e->getMessage() . "\n"; echo "Stack trace:\n" . $e->getTraceAsString() . "\n"; }