1tomany / php-geocoder
A simple framework-independent geocoding library
v0.0.1
2026-08-21 06:49 UTC
Requires
- php: >=8.5
- fakerphp/faker: ^1.24
- phpdocumentor/reflection-docblock: ^5.6|^6.0.3
- symfony/http-client: ^7.2|^8.0|^8.1
- symfony/property-access: ^7.2|^8.0|^8.1
- symfony/property-info: ^7.2|^8.0|^8.1
- symfony/serializer: ^7.2|^8.0|^8.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.93
- phpstan/phpstan: ^2.1.55
- phpunit/phpunit: ^13.1.11
This package is auto-updated.
Last update: 2026-08-21 07:02:50 UTC
README
This package provides a simple framework-independent geocoding library.
Installation
Install the library using Composer:
composer require 1tomany/php-geocoder
Symfony Bundle
A Symfony bundle is available if you wish to integrate this library into your Symfony applications with autowiring and configuration support.
Supported platforms
- Mock
Usage
use OneToMany\Geocoder\Bridge\Google\GoogleProvider; use OneToMany\Geocoder\Bridge\Mock\MockProvider; use OneToMany\Geocoder\Bridge\Transport; use OneToMany\Geocoder\GeocoderClient; use OneToMany\Geocoder\Resource\Geocode; use OneToMany\Geocoder\Resource\Reverse; use OneToMany\Geocoder\Vendor; $transport = new Transport( createSymfonyHttpClient(), createSymfonySerializer(), ); $googleApiKey = getenv('GOOGLE_API_KEY'); $geocoderClient = new GeocoderClient([ new GoogleProvider( transport: $transport, apiKey: $googleApiKey, ), new MockProvider(), ]); $response = $geocoderClient->geocode( Vendor::Google, new Geocode( street: '123 Main Street', unit: null, city: 'Dallas', zip: '75205', state: 'TX', country: null, ), ); $response = $geocoderClient->reverse( Vendor::Google, new Reverse( latitude: 32.10391494, longitude: -96.3931030, ), );
Credits
License
The MIT License