1. Go to this page and download the library: Download windwalker/structure 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/ */
windwalker / structure example snippets
php
$structure->get('foo');
// Get a non-exists value and return default
$structure->get('foo', 'default');
// OR
$structure->get('foo') ?: 'default';
php
// Set a value in the structure.
$structure['foo'] = 'bar';
// Get a value from the structure;
$value = $structure['foo'];
// Check if a key in the structure is set.
if (isset($structure['foo']))
{
echo 'Say bar.';
}
php
$structure1->merge($structure2, false); // Set param 2 to false that Structure will only merge first level
php
$array = array(
'flower' => array(
'sunflower' => 'light',
'sakura' => 'samurai'
)
);
$structure = new Structure($array);
// Make data to one dimension
$flatted = $structure->flatten();
print_r($flatted);
php
use Windwalker\Structure\StructureHelper;
StructureHelper::loadFaile($file, $format); // File to array
StructureHelper::loadString($string, $format); // String to array
StructureHelper::toString($array, $format); // Array to string
// Use format class
$json = StructureHelper::getFormatClass('json'); // Get JsonFormat
$string = $json::structToString($array);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.