| 1 | <?php |
||
| 5 | class GitHubService |
||
| 6 | { |
||
| 7 | const URL = 'https://api.github.com/repos/juanber84/dep/releases/latest'; |
||
| 8 | |||
| 9 | public function latestRelease() |
||
| 10 | { |
||
| 11 | $ch = curl_init(); |
||
| 12 | $timeout = 5; |
||
| 13 | curl_setopt($ch, CURLOPT_URL, self::URL); |
||
| 14 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
||
| 15 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); |
||
| 16 | curl_setopt($ch,CURLOPT_USERAGENT,'Awesome-Octocat-App'); |
||
| 17 | $data = curl_exec($ch); |
||
| 18 | curl_close($ch); |
||
| 19 | |||
| 20 | $latestRelease = json_decode($data, true); |
||
| 21 | |||
| 22 | return $latestRelease; |
||
| 23 | } |
||
| 24 | |||
| 25 | public function latestTimeVersion() |
||
| 32 | |||
| 33 | public function latestBrowserDownloadUrl() |
||
| 40 | } |