app\Application::getLatestVersion PHP Method

getLatestVersion() public method

Get the latest version number of Koel from GitHub.
public getLatestVersion ( Client $client = null ) : string
$client GuzzleHttp\Client
return string
    public function getLatestVersion(Client $client = null)
    {
        if ($v = Cache::get('latestKoelVersion')) {
            return $v;
        }
        $client = $client ?: new Client();
        try {
            $v = json_decode($client->get('https://api.github.com/repos/phanan/koel/tags')->getBody())[0]->name;
            // Cache for one day
            Cache::put('latestKoelVersion', $v, 1 * 24 * 60);
            return $v;
        } catch (Exception $e) {
            Log::error($e);
            return self::VERSION;
        }
    }