Skip to content

Commit b5506c8

Browse files
committed
✨ added package meta data
1 parent dd5c1ee commit b5506c8

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/Utils/Package.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Leaf\Console\Utils;
4+
5+
/**
6+
* Package
7+
* ----
8+
* Meta info on leaf cli
9+
*/
10+
class Package
11+
{
12+
/**
13+
* Check if there is an update available
14+
*/
15+
public static function updateAvailable()
16+
{
17+
$leafCli = json_decode(file_get_contents(dirname(dirname(__DIR__)) . "/composer.json"));
18+
$latestLeafCli = json_decode(file_get_contents("https://repo.packagist.org/p2/leafs/cli.json"));
19+
20+
$currentVersion = $leafCli->version;
21+
$latestVersion = $latestLeafCli->packages->{"leafs/cli"}[0]->version;
22+
23+
return ($currentVersion !== $latestVersion);
24+
}
25+
}
26+

0 commit comments

Comments
 (0)