PHP code example of satheez / php-payload
1. Go to this page and download the library: Download satheez/php-payload 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/ */
satheez / php-payload example snippets
// Build & export the added data:
$payload = new \Php\Data\Payload();
$payload->add('animal.dog.name', 'Zoe');
$payload->add('animal.dog.age', 8);
$payload->add('animal.cat', [
'name' => 'Snowy',
'age' => 3
]);
$data = $payload->export();// Exported data
// Import and retrieve the data:
// Method 1:
$payload1 = new \Php\Data\Payload($data);
// Method 2:
$payload2 = new \Php\Data\Payload();
$payload2->import($data);
// Retrieve
$dog = $payload1->get('animal.dog.name'); // Zoe
bash
composer