Download the PHP package geocoder-php/stack-geo-ip without Composer
On this page you can find all versions of the php package geocoder-php/stack-geo-ip. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download geocoder-php/stack-geo-ip
More information about geocoder-php/stack-geo-ip
Files in geocoder-php/stack-geo-ip
Package stack-geo-ip
Short Description Geolocation Stack middleware for Geocoder library.
License MIT
Informations about the package stack-geo-ip
StackGeoIp
Geolocation Stack middleware that adds geolocation results to the request for subsequent middlewares by leveraging the Geocoder library.
Usage
Example
Here we create a simple application that returns the IP address of the
request and the contents of the X-Country
header to the browser. Normally,
the X-Country
header would not exists.
By wrapping the GeoIP middleware around it using the StackBuilder, if the
IP address can be matched to a country, the X-Country
header will be set
to the two-letter code for that country, and be available to the application.
Options
The following options can be used:
-
adapter (optional): The Geocoder HTTP adapter to use. Defaults to cURL adapter.
-
provider (optional): The Geocoder provider to use. Defaults to the FreeGeoIP provider. For production, it is recommended to use a provider that relies on local files rather than HTTP requests, such as Max Mind binary provider.
- header (optional): The name of the HTTP header to store the country result in. Defaults to "X-Country".
See the Geocoder documentation for a list of available adapters and providers.
Intallation
The recommended way to install StackGeoIp is through Composer:
Protip: you should browse the
geocoder-php/stack-geo-ip
page to choose a stable version to use, avoid the @stable
meta constraint.
License
StackGeoIp is released under the MIT License. See the bundled LICENSE file for details.
All versions of stack-geo-ip with dependencies
symfony/http-foundation Version ~2.1
symfony/http-kernel Version ~2.1
willdurand/geocoder Version ~2.0
pimple/pimple Version ~1.0