Download the PHP package middlewares/geolocation without Composer
On this page you can find all versions of the php package middlewares/geolocation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download middlewares/geolocation
More information about middlewares/geolocation
Files in middlewares/geolocation
Package geolocation
Short Description Middleware to geolocate the client using the ip address
License MIT
Homepage https://github.com/middlewares/geolocation
Informations about the package geolocation
middlewares/geolocation
![SensioLabs Insight][ico-sensiolabs]
Middleware to geolocate the client using the ip address and Geocoder and save the result as a request attribute.
Requirements
- PHP >= 7.0
- A PSR-7 http library
- A PSR-15 middleware dispatcher
- A PHP-HTTP adapter, for example Guzzle6
- A Geocoder ip-based provider
Installation
This package is installable and autoloadable via Composer as middlewares/geolocation.
Example
Options
__construct(Geocoder\Provider\Provider $provider)
The geocoder provider used to geolocate the client.
It's also recommended to configure it to caching responses.
ipAttribute(string $ipAttribute)
By default uses the REMOTE_ADDR
server parameter to get the client ip. This option allows to use a request attribute. Useful to combine with a ip detection middleware, for example client-ip.
attribute(string $attribute)
The attribute name used to store the client addresses in the server request. By default is client-location
.
Please see CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.
All versions of geolocation with dependencies
willdurand/geocoder Version ^4.0
php-http/message Version ^1.6
psr/http-server-middleware Version ^1.0