PHP code example of tohmua / consolidare

1. Go to this page and download the library: Download tohmua/consolidare 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/ */

    

tohmua / consolidare example snippets


$merge = new Consolidare\Merge();

$merge->data('{"id": 10}');
$merge->data(['name' => 'foo', 'email' => 'bar']);
$merge->data(['email' => '[email protected]']);

$result = $merge->merge(Consolidare\MergeStrategy\MergeStrategyFactory::basic());

$result->retrieve(new Consolidare\ReturnType\Type\ToArray);
// ['id' => 10, 'name' => 'foo', 'email' => '[email protected]']