PHP code example of atomicptr / dauntless-builder-sdk
1. Go to this page and download the library: Download atomicptr/dauntless-builder-sdk 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/ */
atomicptr / dauntless-builder-sdk example snippets
$buildId = "OXDriuTRdpCbCbEbYdUwvupvyM8hE0CLDpaVQIfsI2lR2w_5cnD_IL3beFN2C"; // DB Url looks like this: dauntless-builder.com/b/:buildId
$build = Build::fromId($buildId); // this returns a "Result" type and could contain errors
if ($build->hasError()) {
$build->panic(); // throw an exception if something went wrong
}
// get the actual build value
$build = $build->value();
// get weapon 1 id?
$weaponId = $build->weapon1->id;
// change level of head to 20 (max)
$build->head->level = 20;
// do more stuff...
// and serialize it again...
$newBuildId = $build->serialize();
// create a new build url
$url = "https://www.dauntless-builder.com/b/$newBuildId";