designcise / bitframe-geolocation

BitFrame微框架的地理定位中间件

1.0.0 2018-05-18 04:51 UTC

This package is auto-updated.

Last update: 2024-09-29 05:48:28 UTC


README

地理定位包装类,作为中间件获取用户地理数据。

安装

有关安装和使用此中间件的说明,请参阅安装文档

使用示例

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;
    }
]);

测试

要执行测试套件,您需要PHPUnit

贡献

文档

文档可在以下地址获取:

许可证

有关许可信息,请参阅许可证文件