client = Psr18ClientDiscovery::find(); } catch (NotFoundException $exception) { $this->client = HttpClientDiscovery::find(); } $this->messageFactory = Psr17FactoryDiscovery::findRequestFactory(); $this->url = Psr17FactoryDiscovery::findUrlFactory()->createUri('https://api.github.com'); } public function latest($username, $repository) { $request = $this->messageFactory->createRequest( 'GET', $this->url->withPath('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/latest') ); try { return json_decode($this->client->sendRequest($request)->getBody()->getContents()); } catch (ClientExceptionInterface $exception) { PaynowLogger::error("Error occurred during retrieving github latest release information {message={}}", [$exception->getMessage()]); } return null; } }