null, 'changes' => []]; $lines = @file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if ($lines === false) return ['version' => null, 'changes' => []]; $version = null; $changes = []; foreach ($lines as $line) { if (preg_match('/^##\s+(.+)$/', $line, $m)) { if ($version === null) { $version = trim($m[1]); continue; } break; // reached the next version entry } if ($version !== null && str_starts_with(ltrim($line), '-')) { $changes[] = ltrim(ltrim($line), '- '); } } return ['version' => $version, 'changes' => $changes]; }