PHP code example of jbzoo / pimpledumper

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

    

jbzoo / pimpledumper example snippets



et needed classes
use JBZoo\PimpleDumper\PimpleDumper;
use Pimple\Container;

// Init container
$container = new Container();
$container['somekey'] = function() {
    return new SomeClass(); 
};

// Auto dump pimple.json on PimpleDumper destructor (or PHP die)
$container->register(new PimpleDumper()); // register service

// Manually (in the end of script!)
$dumper = new PimpleDumper();
$dumper->dumpPimple($container); // Create new pimple.json 
$dumper->dumpPimple($container, true); // Append to current pimple.json 
$dumper->dumpPhpstorm($container); // Create new .phpstorm.meta.php (experimental!)



/**
 * ProcessWire PhpStorm Meta
 *
 * This file is not a CODE, it makes no sense and won't run or validate
 * Its AST serves PhpStorm IDE as DATA source to make advanced type inference decisions.
 * 
 * @see https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata
 */

namespace PHPSTORM_META {

    $STATIC_METHOD_TYPES = [
        new \Pimple\Container => [
            '' == '@',
            'somekey' instanceof SomeClass,
        ],
    ];

}