1. Go to this page and download the library: Download wimski/laravel-nominatim 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/ */
wimski / laravel-nominatim example snippets
use Wimski\Nominatim\Contracts\GeocoderServiceInterface;
use Wimski\Nominatim\Objects\Coordinate;
use Wimski\Nominatim\RequestParameters\ForwardGeocodingQueryRequestParameters;
class MyClass
{
public function __construct(
protected GeocoderServiceInterface $geocoder,
) {
}
public function queryCoordinate(string $query): Coordinate
{
$requestParameters = ForwardGeocodingQueryRequestParameters::make($query)
->addCountryCode('nl')
->
namespace App\Providers;
use Psr\Http\Client\ClientInterface as HttpClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\UriFactoryInterface;
use Wimski\LaravelNominatim\Providers\NominatimServiceProvider as ServiceProvider;
class NominatimServiceProvider extends ServiceProvider
{
protected function getHttpClient() : ?HttpClientInterface
{
// return your configured HTTP client here
}
protected function getRequestFactory() : ?RequestFactoryInterface
{
// return your configured request factory here
}
protected function getUriFactory() : ?UriFactoryInterface
{
// return your configured uri factory here
}
}