zima/orchid-yandex-map

Yandex map for site

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Language:JavaScript

1.0.0 2025-09-22 12:58 UTC

This package is auto-updated.

Last update: 2025-09-22 13:41:04 UTC


README

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist zima/orchid-yandex-map "*"

or add

"zima/orchid-yandex-map": "*"

Publish config

php artisan vendor:publish --tag=yandex-map-config

Publish resources

php artisan vendor:publish --tag=yandex-map-resources

Publish lang files

php artisan vendor:publish --tag=yandex-map-lang

Usage

In html/.env file add keys YANDEX-MAP-KEY and YANDEX-SUGGEST-KEY

YANDEX-MAP-KEY=
YANDEX-SUGGEST-KEY=

In html/config/platform.php file find key "vite" and add rows like this

    'vite' => [
        ...,

        'resources/css/orchid-yandex-map/app.css',
        'resources/js/orchid-yandex-map/app.js',
    ],

In your database, coordinates should be stored as json, so create json column in your table, e.g:

    Schema::create('places', function (Blueprint $table) {
        ...
        $table->json('map')->nullable();
        ...
    });

In model:

class Place extends Model
{
    ```
    ```

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        ```
        ```
        'map',
    ];

    protected $casts = [
        ```
        ```
        'map' => 'json',
    ];
}

Well, now you are ready to use YMap field on your Orchid screens

    YMap::make('model.map')
        ->title(__('ymap.title'))
        ->help(__('ymap.help'))
        ->height('400px')               // height of map container, default 300px
        ->zoom(12)                      // map zoom, default 14
        ->center('30.314997,59.938784') // coordinates of center, default '37.588144,55.733842' (Moscow)
        ->controls([
            ControlType::GEOLOCATION,   // display or not geolocation (find me) control
            ControlType::SCALE,         // display or not scale control
            ControlType::SEARCH,        // display or not map search control
            ControlType::ZOOM,          // display or not zoom control
    ]),

Also you can hide map field and use suggest field only, or vise versa - use map included search without suggest field

# hide map

    YMap::make('model.map')
        ->title(__('ymap.title'))
        ->help(__('ymap.help'))
        ->hideMap(true)                 //to hide map field
    ),

# or hide suggest field

    YMap::make('model.map')
        ->title(__('ymap.title'))
        ->help(__('ymap.help'))
        ->hideSearch(true)              //to hide map field
        ->controls([
            ControlType::GEOLOCATION,   // display or not geolocation (find me) control
            ControlType::SCALE,         // display or not scale control
            ControlType::SEARCH,        // display or not map search control
            ControlType::ZOOM,          // display or not zoom control
    ]),

License

MIT license.