-
Notifications
You must be signed in to change notification settings - Fork 15
Rules Request
Ben Sherred edited this page Nov 5, 2021
·
6 revisions
To get the current TruckersMP rules as shown here, you can call the rules()
method on the Client
instance:
<?php
require_once('vendor/autoload.php');
$client = new TruckersMP\APIClient\Client();
$rules = $client->rules()->get();
This will return an instance of the Rule
model.
To get the data from the model, a couple of helpful getters have been created as shown below.
Method | Type | Description |
---|---|---|
getRules() |
string | The rules in a markdown format |
getRevision() |
int | The version of the rules |
Below is an example of how you would get the markdown rules:
<?php
require_once('vendor/autoload.php');
$client = new TruckersMP\APIClient\Client();
$rules = $client->rules()->get();
echo $rules->getRules();
To get the revision number, you can use the following snippet:
<?php
require_once('vendor/autoload.php');
$client = new TruckersMP\APIClient\Client();
$rules = $client->rules()->get();
$revision = $rules->getRevision();
echo "This is revision {$revision} of the rules";
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.