PHP code example of berskde / coc-api-php
1. Go to this page and download the library: Download berskde/coc-api-php 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/ */
berskde / coc-api-php example snippets
$client = new Client('API_KEY_HERE');
$client->getClans(['name' => 'Foo', 'minMembers' => 30]); // returns array of Clan objects
$client->getClans('Foo'); // returns array of Clan objects
$clan = $client->getClan('#2VP0J0VV'); // returns Clan object
$clan->name(); // "Hattrickers"
$clan->level(); // 8
$clan->warWins(); // 168
$leader = $clan->memberList()->leader(); // returns Player
$leader->name(); // "VanSilent"
$leader->donations(); // 3451
$leader->expLevel(); // 118
$leader->trophies(); // 2548
$coLeaders = $clan->memberList()->coLeaders(); // array of Player objects
$elders = $clan->memberList()->elders(); // array of Player objects
$leagues = $client->getLeagues(); // returns array of League objects
$leagues[0]->id(); // 29000001
$leagues[0]->name(); // Bronze League III
$client->getLocations(); // returns array of Location objects
$location = $client->getLocation(32000066); // returns Location object
$location->name(); // Croatia
$location->countryCode(); // HR
$location->isCountry(); // true
composer