1. Go to this page and download the library: Download comos/drapper 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/ */
comos / drapper example snippets
$fileContents = file_get_contents('alex.json');
if (!fileContents === false) {
//report the error
}
$data = json_decode($fileContents, true);
if (!is_array($data)) {
//report the error
}
$gender = isset($data['gender']) ? $data['gender'] : 'private';
use Comos\Drapper\Bean;
$data = ['id'=>3, 'name'=>'alex'];
Bean::fromArray($data)->int('id');