PHP code example of innmind / object-graph

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

    

innmind / object-graph example snippets


use Innmind\ObjectGraph\{
    Lookup,
    Render,
    RewriteLocation\SublimeHandler,
};
use Innmind\OperatingSystem\Factory;
use Innmind\Server\Control\Server\Command;

$lookup = Lookup::of();
$render = Render::of(
    new SublimeHandler, // optional, useful to open the file in Sublime Text instead of the browser
);

$objectGraph = $lookup($theRootObjectOfYourApp); // the object could be the framework instance for example

Factory::build()
    ->control()
    ->processes()
    ->execute(
        Command::foreground('dot')
            ->withShortOption('Tsvg')
            ->withShortOption('o', 'graph.svg')
            ->withInput($render($objectGraph)),
    )
    ->wait();