Skip to main content
Glama
DocumentationParser.php1.05 kB
<?php declare(strict_types=1); namespace GoldenPathDigital\LaravelAscend\Documentation; final class DocumentationParser { /** * @return array<string, mixed> */ public function parseJsonFile(string $path): array { if (!is_file($path)) { throw DocumentationException::becauseFileIsMissing($path); } $contents = file_get_contents($path); if ($contents === false) { throw DocumentationException::becauseFileCouldNotBeParsed($path, 'file_get_contents returned false'); } try { /** @var array<string, mixed>|null $decoded */ $decoded = json_decode($contents, true, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { throw DocumentationException::becauseFileCouldNotBeParsed($path, $exception->getMessage()); } if ($decoded === null) { throw DocumentationException::becauseFileCouldNotBeParsed($path, 'decoded data is null'); } return $decoded; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aarongrtech/laravel-ascend'

If you have feedback or need assistance with the MCP directory API, please join our Discord server