Download the PHP package pralhadstha/zipcoder-laravel without Composer
On this page you can find all versions of the php package pralhadstha/zipcoder-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pralhadstha/zipcoder-laravel
More information about pralhadstha/zipcoder-laravel
Files in pralhadstha/zipcoder-laravel
Package zipcoder-laravel
Short Description Laravel package to resolve postal codes and zip codes to addresses. Supports multiple geocoding providers with automatic failover, built-in caching, Facade support, and publishable config.
License MIT
Informations about the package zipcoder-laravel
Zipcoder Laravel
A Laravel package to resolve postal codes and zip codes to addresses. Supports multiple geocoding providers with automatic failover, built-in caching, Facade support, and publishable config.
Why Zipcoder Laravel?
- Multiple providers — GeoNames, Zippopotamus, Zipcodestack, Zipcodebase, and JP Postal Code out of the box
- Automatic failover — Chain of Responsibility pattern tries providers in order until one succeeds
- Built-in caching — PSR-16 cache integration with configurable TTL and store, reducing API calls
- Zero config for free providers — Zippopotamus and JP Postal Code work without API keys
- Custom providers — Register your own provider via config, no package forking needed
- Laravel-native — Auto-discovery, Facade, publishable config, env-driven settings
Requirements
- PHP 8.2 or higher
- Laravel 11, 12, or 13
Installation
The package auto-discovers the service provider and facade. No manual registration needed.
Publish the configuration file:
Configuration
The published config file (config/zipcoder.php) has four sections:
HTTP Client
Uses Guzzle 7+ (ships with Laravel) implementing PSR-18. You can override by binding your own ClientInterface in the container.
Providers
Configure credentials for each provider:
Providers with missing credentials are automatically skipped.
Chain Order
Controls the order in which providers are attempted. The first provider to return a result wins:
Cache
Usage
Basic Lookup
Iterating Results
Checking for Results
Converting to Array
Available Providers
| Provider | Credentials | Countries | Notes |
|---|---|---|---|
| Zippopotamus | None | Multiple | Free, no API key required. Default fallback. |
| GeoNames | username |
Multiple | Free account at geonames.org |
| Zipcodebase | api_key |
Multiple | API key from zipcodebase.com |
| Zipcodestack | api_key |
Multiple | API key from zipcodestack.com |
| JP Postal Code | None | Japan only | Supports en and ja locales |
Custom Providers
Create a class implementing Pralhad\Zipcoder\Contract\Provider:
Register it in the config:
The $client and $requestFactory are injected automatically. Extra config keys (like api_url) are passed as constructor parameters.
Caching
Caching is enabled by default with a 24-hour TTL. Results are cached per postal code and country code using Laravel's cache store.
To disable caching:
To change TTL (in seconds):
To use a specific cache store:
Facade API Reference
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Contributions are welcome! Please see CONTRIBUTING for details.
Security
If you discover a security vulnerability, please see our Security Policy. Do not open a public issue for security vulnerabilities.
License
MIT. See LICENSE for details.
All versions of zipcoder-laravel with dependencies
pralhadstha/zipcoder-php Version ^1.0
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/contracts Version ^10.0|^11.0|^12.0