diff --git a/src/Laravel/ApiPlatformProvider.php b/src/Laravel/ApiPlatformProvider.php index 6100c80629..09eaf07c8a 100644 --- a/src/Laravel/ApiPlatformProvider.php +++ b/src/Laravel/ApiPlatformProvider.php @@ -261,6 +261,15 @@ public function register(): void $refl = new \ReflectionClass(Error::class); $paths[] = \dirname($refl->getFileName()); + $logger = $app->make(LoggerInterface::class); + + foreach ($paths as $i => $path) { + if (!file_exists($path)) { + $logger->warning(\sprintf('We skipped reading resources in "%s" as the path does not exist. Please check the configuration at "api-platform.resources".', $path)); + unset($paths[$i]); + } + } + return new ConcernsResourceNameCollectionFactory($paths, new AttributesResourceNameCollectionFactory($paths)); });