jackmartin/laravel-yandex-geocode

Simply service laravel Yandex Geocoding

v1.2.1 2020-03-06 08:55 UTC

This package is auto-updated.

Last update: 2024-03-06 18:05:08 UTC


README

Simply package laravel Yandex.Geocoding

Latest Stable Version Total Downloads License

Installation

Run composer require command.

composer require jackmartin/laravel-yandex-geocode

Laravel Setting

After updating composer, register the service provider in bootstrap\app.php

Yandex\Geocode\YandexGeocodeServiceProvider::class

Add then alias YaGeo adding its facade to the aliases array in the same file:

'YaGeo' => Yandex\Geocode\Facades\YandexGeocodeFacade::class

Configuration parameters package

Api page: https://tech.yandex.ru/maps/doc/geocoder/desc/concepts/input_params-docpage/

Copy file config yandex-geocoding.php in config folder

php artisan vendor:publish

Select Tag: yandex-geocoding-config

or

php artisan vendor:publish --provider="Yandex\Geocode\YandexGeocodeServiceProvider" --tag="yandex-geocoding-config"

Api key

'api_key' => ''

Api version

'api_version' => '1.x'

Language api response

'language' => 'uk_UA'

Skip object in query

'skip_object' => 0

Usage

dd(

    \YaGeo::make()->setQuery('Ukraine, Kiev')->load()

);

Methods

  1. Get raw data response
  2. Get data response
  3. Get name country
  4. Get name region
  5. Get name district
  6. Get name locality
  7. Get name street
  8. Get house number
  9. Get full raw address
  10. Get full address
  11. Get latitude
  12. Get longitude
  13. Get type

Laravel Яндекс.Геокодирование

Простой пакет laravel Яндекс.Геокодирование

Установка

Установить пакет с помощью composer

composer require jackmartin/laravel-yandex-geocode

Laravel настройка пакета

После установки пакета с помощью composer, зарегистрируйте сервис пакета в файле bootstrap/app.php:

Yandex\Geocode\YandexGeocodeServiceProvider::class

Затем для быстрого вызов класса пакета, добавьте псевдоним в этот же файле:

'YaGeo' => Yandex\Geocode\Facades\YandexGeocodeFacade::class

Настройка параметров пакета

Документация: https://tech.yandex.ru/maps/doc/geocoder/desc/concepts/input_params-docpage/

Копируем файл настроек yandex-geocondig.php в config папку

php artisan vendor:publish

Выбираем Tag: yandex-geocoding-config

или

php artisan vendor:publish --provider="Yandex\Geocode\YandexGeocodeServiceProvider" --tag="yandex-geocoding-config"

Ключ API

'api_key' => ''

API версия

'api_version' => '1.x'

Язык ответа

'language' => 'uk_UA'

Количество пропускаемых объектов в запросе

'skip_object' => 0

Использование

dd(

    \YaGeo::make()->setQuery('Украина, Киев')->load()

);

Методы

  1. Получить сырые данные ответа
  2. Получить данные ответа
  3. Получить имя страны
  4. Получить имя области
  5. Получить имя района
  6. Получить имя населенного пункта
  7. Получить имя улицы
  8. Получить номер дома
  9. Получить полный сырой адрес
  10. Получить полный адрес
  11. Получить широту
  12. Получить долготу
  13. Получить тип

Methods - Методы:

getRawData()

use YaGeo;

$data = YaGeo::setQuery('Kiev, Vishnevoe, Lesi Ukrainki, 57')->load();

$data = $data->getResponse()->getRawData();

getData()

use YaGeo;

$data = YaGeo::setQuery('Kiev, Vishnevoe, Lesi Ukrainki, 57')->load();

$data = $data->getResponse()->getData();

getCountry()

use YaGeo;

$data = YaGeo::setQuery('Kiev, Vishnevoe, Lesi Ukrainki, 57')->load();

$data = $data->getResponse()->getCountry();

getRegion()

use YaGeo;

$data = YaGeo::setQuery('Kiev, Vishnevoe, Lesi Ukrainki, 57')->load();

$data = $data->getResponse()->getCountry();

getDistrict()

use YaGeo;

$data = YaGeo::setQuery('Kiev, Vishnevoe, Lesi Ukrainki, 57')->load();

$data = $data->getResponse()->getDistrict();

getLocality()

use YaGeo;

$data = YaGeo::setQuery('Kiev, Vishnevoe, Lesi Ukrainki, 57')->load();

$data = $data->getResponse()->getLocality();

getStreet()

use YaGeo;

$data = YaGeo::setQuery('Kiev, Vishnevoe, Lesi Ukrainki, 57')->load();

$data = $data->getResponse()->getStreet();

getHouseNumber()

use YaGeo;

$data = YaGeo::setQuery('Kiev, Vishnevoe, Lesi Ukrainki, 57')->load();

$data = $data->getResponse()->getHouseNumber();

getRawFullAddress()

use YaGeo;

$data = YaGeo::setQuery('Kiev, Vishnevoe, Lesi Ukrainki, 57')->load();

$data = $data->getResponse()->getRawFullAddress();

getFullAddress()

use YaGeo;

$data = YaGeo::setQuery('Kiev, Vishnevoe, Lesi Ukrainki, 57')->load();

$data = $data->getResponse()->getFullAddress();

getLatitude()

use YaGeo;

$data = YaGeo::setQuery('Kiev, Vishnevoe, Lesi Ukrainki, 57')->load();

$data = $data->getResponse()->getLatitude();

getLongitude()

use YaGeo;

$data = YaGeo::setQuery('Kiev, Vishnevoe, Lesi Ukrainki, 57')->load();

$data = $data->getResponse()->getLongitude();

getType()

use YaGeo;

$data = YaGeo::setQuery('Kiev, Vishnevoe, Lesi Ukrainki, 57')->load();

$data = $data->getResponse()->getType();