PHP code example of altrntv / yandex-static-api

1. Go to this page and download the library: Download altrntv/yandex-static-api 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/ */

    

altrntv / yandex-static-api example snippets


return [
    'api_key' => env('YANDEX_STATIC_API_KEY'),
    'url' => env('YANDEX_STATIC_API_URL', 'https://static-maps.yandex.ru'),
];

use Altrntv\YandexStaticApi\StaticApi;

$point = new Point(longitude: 32.810152, latitude: 39.889847);

$image = StaticApi::make($point)
    ->boundingBox(new BoundingBox(
        new Point(longitude: 32.810152, latitude: 39.889847),
        new Point(longitude: 32.810152, latitude: 39.889847),
    ))
    ->figures([
        new Line(
            coordinates: [32.810152, 39.889847, 32.810152, 39.889847],
            lineColor: '00FF00A0',
            lineWidth: 1,
            borderColor: '00FF00A0',
            borderWidth: 2,
        ),
    ])
    ->language(Language::RussianRussia)
    ->mapType(MapType::Map)
    ->placemarks([
        new Placemark(
            point: new Point(longitude: 32.810152, latitude: 39.889847),
            style: PlacemarkStyle::Pm,
            color: PlacemarkColor::Pink,
            size: PlacemarkSize::Large,
            content: 100,
        ),
    ])
    ->scale(1)
    ->size(new Size(width: 650, height: 450))
    ->span(10)
    ->theme(Theme::Light)
    ->zoom(10)
    ->fetch();
bash
php artisan vendor:publish --tag=yandex-static-api-config