designcise/bitframe-geolocation

GeoLocation middleware for BitFrame microframework

1.0.0 2018-05-18 04:51 UTC

This package is auto-updated.

Last update: 2024-04-29 04:06:08 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

Documentation

Documentation is available at:

License

Please see License File for licensing information.