1. Go to this page and download the library: Download fw4/mason-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 / mason-api example snippets
use Mason\Api\Client;
$api = new Client('client-id', 'client-secret');
$group = $api->group(123);
$estates = $group->estates->list();
// Traversing over the response takes care of pagination in the background
foreach ($estates as $estate) {
echo $estate->name . PHP_EOL;
}
use Mason\Api\Auth\TokenStorage\FileTokenStorage;
$api = new Client(
clientId: 'client-id',
clientSecret: 'client-secret',
tokenStorage: new FileTokenStorage('/secure/cache/mason-api'),
);
use Mason\Api\Auth\TokenStorage\RedisTokenStorage;
$redis = new Redis();
$redis->connect('127.0.0.1');
$api = new Client(
clientId: 'client-id',
clientSecret: 'client-secret',
tokenStorage: new RedisTokenStorage($redis),
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.