-
Notifications
You must be signed in to change notification settings - Fork 15
Company Request
You can get the information for a player by calling the player() method on the Client instance. This method takes 1 parameter which can either be the players SteamID64 or TruckersMP ID like so:
To get the information for a company, you can call the company(int $id) method on an instance of Client. This method takes 1 parameter which is the ID of the company you would like to get information for. Below is an example of how you would make a request:
<?php
require_once('vendor/autoload.php');
$client = new TruckersMP\APIClient\Client();
$company = $client->company(1)->get();This will return an instance of the Company model.
To get the data from the model, a number of helpful getters have been created as shown below.
| Method | Type | Description |
|---|---|---|
getId() |
int | The ID of the company requested |
getName() |
string | The name of the requested company |
getOwnerId() |
int | The player ID of the company owner |
getOwnerName() |
string | The name of the company owner |
getSlogan() |
string | The companies slogan |
getTag() |
string | The companies tag |
getLogo() |
string | The URL to the companies logo |
getCover() |
string | The URL to the companies cover image |
getInformation() |
string | Information about the company |
getRequirements() |
string | The companies requirements in order to join |
getWebsite() |
string | The companies website URL |
getSocial() |
Social | The companies social information |
getGames() |
Game | The games which the company support |
getMembersCount() |
int | The numbers of members in the company |
getRecruitment() |
string | The companies recruitment status |
getLanguage() |
string | The companies primary language |
isVerified() |
bool | Is the company verified or not |
isValidated() |
bool | Check if the company is validated or not |
getCreatedDate() |
Carbon | The timestamp the company was created |
isRecruitmentClosed() |
bool | Is recruitment closed |
isRecruitmentOpen() |
bool | Is recruitment open |
Below is an example of how you would get the companies name:
<?php
require_once('vendor/autoload.php');
$client = new TruckersMP\APIClient\Client();
$company = $client->company(1)->get();
echo 'The companies name is ' . $company->getName();The Social model returns the companies social information.
| Method | Type | Description |
|---|---|---|
getTwitter() |
?string | The companies Twitter URL |
getFacebook() |
?string | The companies Facebook URL |
getTwitch() |
?string | The companies Twitch URL |
getDiscord() |
?string | The companies Discord URL |
getYouTube() |
?string | The companies YouTube URL |
The Game model has a couple of methods to get the supported company games.
| Method | Type | Description |
|---|---|---|
isAts() |
bool | The company supports American Truck Simulator |
isEts() |
bool | The company supports Euro Truck Simulator 2 |
If you have any questions about the library, you can create a topic on our forum.
This package is open-source and is licensed under the MIT license.