1. Go to this page and download the library: Download viral-agency/master-caster 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/ */
viral-agency / master-caster example snippets
namespace SomeNameSpace;
use ViralAgency\MasterCaster;
class SampleResponse extends MasterCaster {
public int $sampleInt;
public string $sampleString;
public SampleObject $sampleObject;
public array $sampleObjectsM
}
namespace SomeNameSpace;
use ViralAgency\MasterCaster;
class SampleObject extends MasterCaster {
public int $sampleInt;
public string $sampleString;
}
namespace SomeNameSpace;
use ViralAgency\MasterCaster;
class CustomCaster extends MasterCaster {
private function handleArrayValue(string $key, array $values): void
{
foreach ( $values as $value ) {
//add here the cases
if ($key === "video"){
$this->$key[] = $this->buildObject( $key, $value, false);
}
//otherwise let's proceed in default way
else {
$this->key[] = is_object($values) ? $this->buildObject($key, $value, true) : $value;
}
}
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.