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.

 

Installation

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

 

Documentation

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

 

Example

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

<?php

require_once('vendor/autoload.php');

$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

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

Changed

  • Updated all dependencies

 

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

 

Added

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

Changed

  • 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

  • 3 years later...

Dear TruckersMP  Team,

I wanted to express my heartfelt gratitude for providing such a valuable and convenient tool for accessing the TruckersMP API from PHP applications. Your PHP library has been an incredible resource, allowing developers like me to seamlessly integrate with the TruckersMP API and retrieve data effortlessly.

The pre-defined set of classes for each API endpoint makes it so much easier to fetch the data as a collection or model, streamlining the development process. I truly appreciate the effort and dedication put into creating and maintaining this remarkable library.

Moreover, the comprehensive documentation on the GitHub Wiki has been immensely helpful in guiding me through the installation and usage of the library. It's evident that the team has put great care into ensuring that developers have all the necessary information to utilize the library effectively.

I was particularly impressed with the example provided, showcasing how to retrieve a player's name using the client. It made the integration process a breeze and saved me a lot of time.

Thank you once again for your hard work and for continuously improving the library. Your efforts have undoubtedly made the lives of PHP developers in the TruckersMP community much easier. I look forward to exploring the new major version released on December 24th, 2019, and leveraging the latest features in my projects.

Keep up the excellent work, and know that your contributions are highly valued and appreciated by the developer community.

With sincere gratitude,
AlparslanK

Karakteriniz düzgün olsun ki gerisini hallederiz..

My first condition is that your character is not broken...

AlparslanK

 

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.