PHP code example of andrew-gos / double-gis

1. Go to this page and download the library: Download andrew-gos/double-gis 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/ */

    

andrew-gos / double-gis example snippets


    

    use AndrewGos\DoubleGis\DoubleGisFactory;
    use AndrewGos\DoubleGis\ValueObject\AuthToken;

    $doubleGis = DoubleGisFactory::getDefault(new AuthToken('123456-7890-abcd-ef12-34567890abcd'));
    

    

    use AndrewGos\DoubleGis\DoubleGisFactory;
    use AndrewGos\DoubleGis\ValueObject\AuthToken;

    $doubleGis = DoubleGisFactory::getDefault(new AuthToken('123456-7890-abcd-ef12-34567890abcd'));
    $api = $doubleGis->getApi();
    

    

    use AndrewGos\DoubleGis\DoubleGisFactory;
    use AndrewGos\DoubleGis\ValueObject\AuthToken;
    use AndrewGos\DoubleGis\Request\RegionGetRequest;
    use AndrewGos\DoubleGis\Entity\Region;

    $doubleGis = DoubleGisFactory::getDefault(new AuthToken('123456-7890-abcd-ef12-34567890abcd'));
    $api = $doubleGis->getApi();
    $regionResponse = $api->regionGet(new RegionGetRequest('1'));
    /** @var Region[] $regions */
    $regions = $regionResponse->getResult()?->getItems();
    

    

    use AndrewGos\DoubleGis\DoubleGisFactory;
    use AndrewGos\DoubleGis\ValueObject\AuthToken;

    $doubleGis = DoubleGisFactory::getDefault(new AuthToken('123456-7890-abcd-ef12-34567890abcd'));
    $doubleGis->setLogger(new MyLogger());
    

// IN main.php OR web.php
// your config:
[
    'container' => [
        'definitions' => [
            \AndrewGos\DoubleGis\DoubleGis::class => function () {
                return \AndrewGos\DoubleGis\DoubleGisFactory::getDefault(
                    new \AndrewGos\DoubleGis\ValueObject\AuthToken('YOUR_TOKEN');
                ),
            },
        ],
    ],
];