1. Go to this page and download the library: Download fw4/organimmo-rental-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fw4 / organimmo-rental-api example snippets
use Organimmo\Rental\Organimmo;
$client = new Organimmo('customer-id');
// Retrieve existing access token from storage (getAccessTokenFromDataStore to be implemented)
$accessToken = getAccessTokenFromDataStore();
if (empty($accessToken) || $accessToken->hasExpired()) {
// Request and store new access token (saveAccessTokenToDataStore to be implemented)
$accessToken = $client->requestAccessToken('client-id', 'client-secret', 'username', 'password');
saveAccessTokenToDataStore($accessToken);
} else {
$client->setAccessToken($accessToken);
}
$country = $client->countries()->get(1);
if (is_null($country)) echo 'Country does not exist' . PHP_EOL;
else echo $country->name . PHP_EOL;