'The package manifest is not valid JSON.']); } $manifest = $decoded; } foreach (['name', 'type', 'version'] as $field) { if (! filled(Arr::get($manifest, $field))) { throw ValidationException::withMessages(['manifest' => "Manifest field [$field] is required."]); } } if (! in_array($manifest['type'], config('marketplace.supported_types', []), true)) { throw ValidationException::withMessages(['manifest' => 'Unsupported marketplace package type.']); } $manifest['requires'] = $manifest['requires'] ?? []; $manifest['content_manager'] = $manifest['content_manager'] ?? '*'; $manifest['laravel'] = $manifest['laravel'] ?? '*'; return $manifest; } public function fromFile(string $path): array { return $this->parse((string) file_get_contents($path)); } }