承接 brightnucleus/geolite2-country 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

brightnucleus/geolite2-country

最新稳定版本:v0.2.3

Composer 安装命令:

composer require brightnucleus/geolite2-country

包简介

Composer-packaged version of the free MaxMind GeoLite2 Country database.

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

This is a Composer plugin that provides an automated binary version of the free MaxMind GeoLite2 Country database.

The main advantage is that the downloaded database will be checked for updates on each composer install and composer update.

Table Of Contents

Attribution

This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com.

Installation

The only thing you need to do to make this work is adding this package as a dependency to your project:

composer require brightnucleus/geolite2-country

Basic Usage

On each composer install or composer update, a check will be made to see whether there's a new version of the database available. If there is, that new version is downloaded.

To retrieve the path to the binary database file from within your project, you can use the Database::getLocation() method:

<?php

use BrightNucleus\GeoLite2Country\Database;

$dbLocation = Database::getLocation();

You can pass this location on to the GeoIp2\Database\Reader class that is provided with the geoip2/geoip2 Composer package.

Example

The following example assumes that you have added the geoip2/geoip2 Composer package as a dependency to your project, so that it is available to the autoloader.

<?php

use GeoIp2\Database\Reader;
use BrightNucleus\GeoLite2Country\Database;

function getCountry($ip) {
    $dbLocation = Database::getLocation();
    $reader = new Reader($dbLocation);

    return $reader->country($ip);
}

Contributing

All feedback / bug reports / pull requests are welcome.

License

This code is released under the MIT license.

For the full copyright and license information, please view the LICENSE file distributed with this source code.

统计信息

  • 总下载量: 17.98k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 23
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 23
  • Watchers: 1
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-03