Skip to content

Version Request

Ben Sherred edited this page Dec 7, 2019 · 3 revisions

You can get the current the current TruckersMP version information by calling the version() method on the Client instance:

<?php

require_once('vendor/autoload.php');

$client = new TruckersMP\APIClient\Client();

$version = $client->version()->get();

This will return an instance of the Version model.

The Model

To get the data from the model, a couple of helpful getters have been created as shown below.

Method Type Description
getName() string The name of the current version
getNumeric() string The numeric name of the current version
getStage() string The current stage in the development process
getETS2MPChecksum() Checksum Checksum information for ETS2MP
getATSMPChecksum() Checksum Checksum information for ATSMP
getTime() Carbon The time that the version was released
getSupportedETS2GameVersion() string The ETS2 version that is supported
getSupportedATSGameVersion() string The ATS version that is supported

Example

Below is an example of how you could use the version information:

<?php

require_once('vendor/autoload.php');

$client = new TruckersMP\APIClient\Client();
$version = $client->version()->get();

$currentVersion = $version->getName();
$supportedETS2Version = $version->getSupportedETS2GameVersion();
$supportedATSVersion = $version->getSupportedATSGameVersion();

$versionInfo = 'The current version of TruckersMP is {$currentVersion}';
$versionInfo .= ' which supports v{$supportedETS2Version} of ETS2';
$versionInfo .= ' and v{$supportedATSVersion} of ATS.';

echo $versionInfo;

The Checksum Model

Both the getETS2MPChecksum() and getATSMPChecksum() methods return an instance of a Checksum model. The model has 2 getters as shown below:

Method Type Description
getDLL() string The checksum of the DLL for the specified game
getADB() string The checksum of the ADB for the specified game