PHP code example of encoredigitalgroup / dynamicdata
1. Go to this page and download the library: Download encoredigitalgroup/dynamicdata 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/ */
encoredigitalgroup / dynamicdata example snippets
use EncoreDigitalGroup\DynamicData\Helpers\DynamicData
$ddo = new DynamicData()
$ddo->setName('your_custom_field');
$ddo->setType('string');
$ddo->setLabel('Favorite TV Show');
$ddo->setValue('Suits');
$ddo->setExternal();
$ddo->setRequired(false);
$ddo->setShallEncrypt(false);
//Build the Object as an Array
$ddo->buildAsArray();
//or
$ddo->build(); //build() is a wrapper for buildAsArray()
//Build the Object as a JSON String
$ddo->buildAsJson() //buildAsJson() is a wrapper for buildAsArray() that also runs json_encode() prior to returning the encoding JSON String