isFile()) { continue; } $relativePath = substr($file->getPathname(), strlen($basePath) + 1); foreach ($excludedPrefixes as $prefix) { if (str_starts_with($relativePath, $prefix)) { continue 2; } } $files[] = $relativePath; } sort($files); $json = json_encode($files, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); file_put_contents($basePath.'/manifest.json', $json."\n"); $count = count($files); fwrite(STDOUT, "manifest.json written with {$count} files.\n");