PHP code example of senet-eindhoven / cartograph

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

    

senet-eindhoven / cartograph example snippets



use Senet\Cartograph\MapperService;
use Senet\Cartograph\Mapping\DirectMapping;
use Senet\Cartograph\MappingRepository;

$foo = new Foo();
$bar = new Bar();

// Initiate the MapperService
$mappingRepository = new MappingRepository();
$mapperService = new MapperService($mappingRepository);

// Register a mapping from Foo, to Bar using the DirectMapping
$mappingRepository->addMapping(Foo::class, Bar::class, DirectMapping::class);

// Map Foo -> Bar. Will fetch the previously registered Mapping
$mapperService->map($foo, $bar);