Jump to content

TruckersMP API Client for PHP


Recommended Posts

The TruckersMP PHP library provides a convenient way to access the TruckersMP API from applications written in the PHP language. It includes a pre-defined set of classes for each API endpoint to get the data as a collection or model.


You can find the source code on GitHub and view the package on Packagist.



For installation instructions, please refer to the Installation & Usage page of the Wiki.



You can find the documentation by visiting the Wiki on GitHub.



Below is an example of how you can get the name of a player using the client.



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

echo 'The players name is ' . $player->getName();


For those of you who currenly use the API Client, a new major version was released today (24th December 2019).

  • Like 2
  • Upvote 1
Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
  • 1 month later...
  • CJMAXiK pinned this topic
  • 1 month later...

v1.1.1 has been released (2020-06-20)



  • Added the ability to get player's Discord Snowflake
  • Added the ability to get the color of player's group


  • Updated all dependencies


v1.2.0 has been releasd (2020-07-18)



  • Added if the player is a staff member and/or is part of upper staff
  • Added the ability to get the users Patreon information.


  • Updated composer dependencies
  • Changed the test names to include underscores - this makes the names slightly easier to read
  • HaulieLove 3
Link to comment
Share on other sites


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.