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

Share this post

Link to post
Share on other sites

v1.1.0 has been released



  • Added the ability to get the companies validation status (i.e. if they are validated or not) (#17)


  • Cleaned up the project by adding missing documentation, return types and spacing within PHPDocs (#17)
  • Changed StyleCI and tests to test against PSR12 (#17)
  • Updated composer dependencies (#17)
  • Upvote 1

Share this post

Link to post
Share on other sites

  • Create New...