designcise / bitframe-geolocation
GeoLocation middleware for BitFrame microframework
1.0.0
2018-05-18 04:51 UTC
Requires
- php: >=7.1.0
- designcise/bitframe: ^1.0.0
- geocoder-php/chain-provider: ^4.0
- geocoder-php/free-geoip-provider: ^4.0
- geocoder-php/geo-plugin-provider: ^4.0
- php-http/guzzle6-adapter: ^1.1
- php-http/message: ^1.6
- psr/http-server-middleware: ~1.0
- willdurand/geocoder: ^4.0
Requires (Dev)
- phpunit/phpunit: ^6.4
This package is auto-updated.
Last update: 2025-03-01 00:23:55 UTC
README
Geo Location wrapper class to fetch user geo data as a middleware.
Installation
See installation docs for instructions on installing and using this middleware.
Usage Example
use \BitFrame\Locale\GeoLocation;
use \BitFrame\Locale\GeoLocationData;
require 'vendor/autoload.php';
$app = new \BitFrame\Application;
$app->run([
/* In order to output the http response from the middlewares,
* make sure you include a response emitter middleware, for example:
* \BitFrame\Message\DiactorosResponseEmitter::class, */
GeoLocation::class,
function($request, $response, $next) {
$loc = $request->getAttribute(GeoLocationData::class);
$response->getBody()->write('<pre>' . print_r($loc, true) . '</pre>');
return $response;
}
]);
Tests
To execute the test suite, you will need PHPUnit.
Contributing
- File issues at https://github.com/designcise/bitframe-geolocation/issues
- Issue patches to https://github.com/designcise/bitframe-geolocation/pulls
Documentation
Documentation is available at:
License
Please see License File for licensing information.