diff --git a/composer.json b/composer.json index 9a0ef24..ff00b0a 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ } ], "require": { + "composer-runtime-api": "^2.0", "ext-curl": "*", "ext-json": "*", "nesbot/carbon": "^2.0", diff --git a/src/HypernodeClient.php b/src/HypernodeClient.php index 629cb56..0774f76 100644 --- a/src/HypernodeClient.php +++ b/src/HypernodeClient.php @@ -15,8 +15,6 @@ class HypernodeClient { - public const VERSION = '0.1.0'; - public HttpMethodsClientInterface $api; public App $app; public BrancherApp $brancherApp; diff --git a/src/HypernodeClientFactory.php b/src/HypernodeClientFactory.php index dfda8ca..e25be4b 100644 --- a/src/HypernodeClientFactory.php +++ b/src/HypernodeClientFactory.php @@ -4,6 +4,7 @@ namespace Hypernode\Api; +use Composer\InstalledVersions; use Http\Client\Common\HttpMethodsClient; use Http\Client\Common\Plugin\AddHostPlugin; use Http\Client\Common\Plugin\AddPathPlugin; @@ -21,7 +22,10 @@ public static function create(string $authToken, ?ClientInterface $httpClient = { $httpHeaders = [ 'Authorization' => sprintf('Token %s', $authToken), - 'User-Agent' => sprintf('Hypernode API PHP Client v%s', HypernodeClient::VERSION), + 'User-Agent' => sprintf( + 'Hypernode API PHP Client v%s', + InstalledVersions::getVersion('hypernode/api-client'), + ), 'Accept' => 'application/json', 'Content-Type' => 'application/json', ];