juskiewicz / geolocation
Biblioteka obsługująca Geocoding API firmy Google
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/juskiewicz/geolocation
Requires
- php: >=7.2
- ext-json: *
- guzzlehttp/guzzle: ^6.3
This package is auto-updated.
Last update: 2025-10-17 03:15:54 UTC
README
Klasa Geolocation łączy się z Google Maps API i wyszukuje współrzędne lub adres.
Instalacja
Composer
Za pomocą Composer możesz zawsze pobrać najnowszą wersję.
composer require juskiewicz/geolocation
Sprawdź w Packagist.
Przykłady użycia
getCoordinatesByObject
Pobiera obiekt Coordinates za pomocą obiektu Address.
$streetName = 'Maltańska'; $streetNumber = '1', $postalCode = '61-131', $locality = 'Poznań', $country = 'Polska', $address = new Address( null, $streetName, $streetNumber, $postalCode, $locality, $country ); $geolocation = new Geolocation('YOUR_GOOGLE_MAPS_API_KEY', 'pl', 'pl'); $coordinates = $coordinates = $geolocation->getCoordinatesByObject($address); // Współrzędne $latitude = $coordinates->getLatitude(); $longitude = $coordinates->getLongitude(); $tablica = $coordinates->toArray();
getCoordinatesByString
Pobiera obiekt Coordinates za pomocą stringu.
$address = "Maltańska 1, 61-131 Poznań, Polska"; $geolocation = new Geolocation('YOUR_GOOGLE_MAPS_API_KEY', 'pl', 'pl'); $coordinates = $geolocation->getCoordinatesByString($address);
getAddress
Pobiera obiekt Address za pomocą obiektu Coordinates.
$latitude = 51.8990865; $longitude = 17.7863699; $coordinates = new Coordinates($latitude, $longitude); $geolocation = new Geolocation('YOUR_GOOGLE_MAPS_API_KEY','pl', 'pl'); $address = $geolocation->getAddress($coordinates);
Sprawdź źródło klasy Geolocation. Sprawdź źródło klasy Address. Sprawdź źródło klasy Coordinates.