Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Php Geocoder Bundle

Php Geocoder Bundle Laravel Package

1tomany/php-geocoder-bundle

A Symfony bundle wrapping the 1tomany/php-geocoder library, giving you an injectable GeocoderClientInterface for geocoding and reverse geocoding through providers like Google, with simple YAML configuration and a mock provider for testing.

View on GitHub
Deep Wiki
Context7

PHP Geocoder Bundle integrates the 1tomany/php-geocoder library into Symfony, providing a ready-to-use GeocoderClientInterface service for geocoding and reverse geocoding addresses.

Configure the bundle via onetomany_geocoder.yaml to set the HTTP transport, Google API credentials, and optional mock provider for testing. Symfony's http_client and serializer services are wired in automatically, so setup stays minimal.

  • Seamless Symfony service autowiring and DI integration
  • Google provider with configurable API key and version
  • Mock provider toggle for test environments
  • Simple geocode and reverse resource API
  • Environment-aware configuration via when@test
Frequently asked questions about Php Geocoder Bundle
How do I install and configure the 1tomany/php-geocoder-bundle in Symfony?
Install it with composer require 1tomany/php-geocoder-bundle. Then create config/packages/onetomany_geocoder.yaml if you need to override defaults. The transport normally uses Symfony's http_client service, and the bundle wires in serializer automatically.
What should go in onetomany_geocoder.yaml?
The file can define a transport block, a google block with api_key and api_version, and a mock flag. The transport block is usually omitted because the bundle defaults to Symfony's http_client service. The google block is optional; if omitted, the Google provider is not registered. The mock provider is disabled by default.
How do I enable the mock provider for Symfony tests?
Add a when@test section in config/packages/onetomany_geocoder.yaml with onetomany_geocoder: mock: true. This keeps the mock disabled outside the test environment. It is intended for testing, not production geocoding.
How do I inject GeocoderClientInterface and geocode an address?
Type-hint OneToMany\Geocoder\Contract\GeocoderClientInterface in your service constructor and let Symfony autowire it. Call geocode with Vendor::Google and a Geocode resource containing street, unit, city, zip, state, and country fields. For reverse geocoding, call reverse with Vendor::Google and a Reverse resource containing latitude and longitude.
Does 1tomany/php-geocoder-bundle work with Laravel?
No, this is a Symfony bundle rather than a Laravel package. It depends on Symfony service autowiring, http_client, serializer, and YAML configuration under config/packages. For Laravel, use the underlying 1tomany/php-geocoder library directly or find a Laravel-specific integration.
Which Symfony versions are supported by this bundle?
The provided README does not list Symfony version constraints. Check the package's composer.json for its symfony/framework-bundle and related requirements before installing. Confirm compatibility with your Symfony version in a test environment first.
How does the bundle use Symfony http_client and serializer services?
The transport defaults to Symfony's http_client service, so you normally do not need to configure a transport block. The bundle injects Symfony's serializer service into the transport automatically. You can still set transport.http_client in YAML if you need a custom client.
What Google API key and API version configuration is required?
The example configuration uses google.api_key set to %env(GOOGLE_API_KEY)% and google.api_version set to v4. The google block is optional, but omitting it means the Google provider is not registered. Keep the API key in environment variables rather than committing it to YAML.
Can I run this bundle in production without the Google provider?
Yes, if you omit the google block the Google provider is not registered with the GeocoderClient. The mock provider is disabled by default and is meant for test environments, not production. For real geocoding in production, configure the google block with valid credentials.
Is this bundle actively maintained, and what are the alternatives?
The README does not state a maintenance status or release cadence, so check the GitHub repository for recent commits and releases. As an alternative, you can use the underlying 1tomany/php-geocoder library directly or evaluate other Symfony geocoder integrations. This bundle is not a Laravel package, so Laravel projects should look elsewhere.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle