Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f0c743afd | ||
|
|
4e92cd0254 | ||
|
|
d61ddda4ef | ||
|
|
10ecb36d16 | ||
|
|
205483e14c | ||
|
|
6584b545ea | ||
|
|
ac6592b7a5 | ||
|
|
cb9c024699 | ||
|
|
e014aadf8d | ||
|
|
a043336cae | ||
|
|
0c9b774015 | ||
|
|
38bacff692 | ||
|
|
5cfe1353bb | ||
|
|
6715f848bb | ||
|
|
56407eff17 | ||
|
|
9b2fa1bcd1 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@ _site
|
|||||||
composer.lock
|
composer.lock
|
||||||
composer.phar
|
composer.phar
|
||||||
phpunit.xml
|
phpunit.xml
|
||||||
|
geoip2.phar
|
||||||
geoip2-php.sublime-*
|
geoip2-php.sublime-*
|
||||||
vendor/
|
vendor/
|
||||||
*.sw?
|
*.sw?
|
||||||
|
|||||||
@@ -4,16 +4,18 @@ php:
|
|||||||
- 5.3
|
- 5.3
|
||||||
- 5.4
|
- 5.4
|
||||||
- 5.5
|
- 5.5
|
||||||
|
- 5.6
|
||||||
|
- hhvm
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- composer self-update
|
- composer self-update
|
||||||
- composer install --dev -n --prefer-source
|
- composer install --dev -n --prefer-source
|
||||||
- pyrus install pear/PHP_CodeSniffer
|
- if [ "5.5" == $TRAVIS_PHP_VERSION ]; then pyrus install pear/PHP_CodeSniffer; fi
|
||||||
- phpenv rehash
|
- phpenv rehash
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- mkdir -p build/logs
|
- mkdir -p build/logs
|
||||||
- phpcs --standard=PSR2 src/
|
- if [ "5.5" == $TRAVIS_PHP_VERSION ]; then phpcs --standard=PSR2 src/; fi
|
||||||
- phpunit -c phpunit.xml.dist
|
- phpunit -c phpunit.xml.dist
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
|
|||||||
21
CHANGELOG.md
21
CHANGELOG.md
@@ -1,6 +1,27 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
0.6.3 (2014-05-12)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* With the previous Phar builds, some users received `phar error: invalid url
|
||||||
|
or non-existent phar` errors. The correct alias is now used for the Phar,
|
||||||
|
and this should no longer be an issue.
|
||||||
|
|
||||||
|
0.6.2 (2014-05-08)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* The Phar build was broken with Guzzle 3.9.0+. This has been fixed.
|
||||||
|
|
||||||
|
0.6.1 (2014-05-01)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* This API now officially supports HHVM.
|
||||||
|
* The `maxmind-db/reader` dependency was updated to a version that does not
|
||||||
|
require BC Math.
|
||||||
|
* The Composer compatibility autoload rules are now targeted more narrowly.
|
||||||
|
* A `box.json` file is included to build a Phar package.
|
||||||
|
|
||||||
0.6.0 (2014-02-19)
|
0.6.0 (2014-02-19)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|||||||
26
README.md
26
README.md
@@ -7,12 +7,13 @@ This package provides an API for the GeoIP2 [web services]
|
|||||||
(http://dev.maxmind.com/geoip/geoip2/downloadable). The API also works with
|
(http://dev.maxmind.com/geoip/geoip2/downloadable). The API also works with
|
||||||
the free [GeoLite2 databases](http://dev.maxmind.com/geoip/geoip2/geolite2/).
|
the free [GeoLite2 databases](http://dev.maxmind.com/geoip/geoip2/geolite2/).
|
||||||
|
|
||||||
## Installation ##
|
## Install via Composer ##
|
||||||
|
|
||||||
### Define Your Dependencies ###
|
### Define Your Dependencies ###
|
||||||
|
|
||||||
We recommend installing this package with [Composer](http://getcomposer.org/).
|
We recommend installing this package with [Composer](http://getcomposer.org/).
|
||||||
To do this, add `geoip2/geoip2` to your `composer.json` file.
|
To do this, add `geoip2/geoip2` to your `composer.json` file. If you don't
|
||||||
|
have a `composer.json` file, create one in the root directory of your project.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@@ -45,7 +46,20 @@ You can autoload all dependencies by adding this to your code:
|
|||||||
require 'vendor/autoload.php';
|
require 'vendor/autoload.php';
|
||||||
```
|
```
|
||||||
|
|
||||||
### Optional C Extension ###
|
## Installing via Phar ##
|
||||||
|
|
||||||
|
Although we strongly recommend using Composer, we also provide a
|
||||||
|
[phar archive](http://php.net/manual/en/book.phar.php) containing all of the
|
||||||
|
dependencies for GeoIP2. Our latest phar archive is available on
|
||||||
|
[our releases page](https://github.com/maxmind/GeoIP2-php/releases).
|
||||||
|
|
||||||
|
To use the archive, just require it from your script:
|
||||||
|
|
||||||
|
```php
|
||||||
|
require 'geoip2.phar';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Optional C Extension ##
|
||||||
|
|
||||||
The [MaxMind DB API](https://github.com/maxmind/MaxMind-DB-Reader-php)
|
The [MaxMind DB API](https://github.com/maxmind/MaxMind-DB-Reader-php)
|
||||||
includes an optional C extension that you may install to dramatically increase
|
includes an optional C extension that you may install to dramatically increase
|
||||||
@@ -68,7 +82,7 @@ classes for the different parts of the data such as the city in which the
|
|||||||
IP address is located.
|
IP address is located.
|
||||||
|
|
||||||
If the record is not found, a `\GeoIp2\Exception\AddressNotFoundException`
|
If the record is not found, a `\GeoIp2\Exception\AddressNotFoundException`
|
||||||
is returned. If the database is invalid or corrupt, a
|
is thrown. If the database is invalid or corrupt, a
|
||||||
`\MaxMind\Db\InvalidDatabaseException` will be thrown.
|
`\MaxMind\Db\InvalidDatabaseException` will be thrown.
|
||||||
|
|
||||||
See the API documentation for more details.
|
See the API documentation for more details.
|
||||||
@@ -220,6 +234,8 @@ to the client API, please see
|
|||||||
This code requires PHP 5.3 or greater. Older versions of PHP are not
|
This code requires PHP 5.3 or greater. Older versions of PHP are not
|
||||||
supported.
|
supported.
|
||||||
|
|
||||||
|
This library works and is tested with HHVM.
|
||||||
|
|
||||||
This library also relies on the [Guzzle HTTP client](http://guzzlephp.org/)
|
This library also relies on the [Guzzle HTTP client](http://guzzlephp.org/)
|
||||||
and the [MaxMind DB Reader](https://github.com/maxmind/MaxMind-DB-Reader-php).
|
and the [MaxMind DB Reader](https://github.com/maxmind/MaxMind-DB-Reader-php).
|
||||||
|
|
||||||
@@ -234,7 +250,7 @@ The GeoIP2 PHP API uses [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## Copyright and License ##
|
## Copyright and License ##
|
||||||
|
|
||||||
This software is Copyright (c) 2013 by MaxMind, Inc.
|
This software is Copyright (c) 2014 by MaxMind, Inc.
|
||||||
|
|
||||||
This is free software, licensed under the Apache License, Version 2.0.
|
This is free software, licensed under the Apache License, Version 2.0.
|
||||||
|
|
||||||
|
|||||||
34
box.json
Normal file
34
box.json
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"alias": "geoip2.phar",
|
||||||
|
"main": "phar-stub.php",
|
||||||
|
"output": "geoip2.phar",
|
||||||
|
"compactors": [
|
||||||
|
"Herrera\\Box\\Compactor\\Composer",
|
||||||
|
"Herrera\\Box\\Compactor\\Json",
|
||||||
|
"Herrera\\Box\\Compactor\\Php"
|
||||||
|
],
|
||||||
|
"files": [
|
||||||
|
"LICENSE"
|
||||||
|
],
|
||||||
|
"finder": [
|
||||||
|
{
|
||||||
|
"name": [
|
||||||
|
"*.php",
|
||||||
|
"*.pem",
|
||||||
|
"*.pem.md5"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"phpunit",
|
||||||
|
"satooshi",
|
||||||
|
"Tests",
|
||||||
|
"tests",
|
||||||
|
"yaml"
|
||||||
|
],
|
||||||
|
"in": "vendor"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"directories": ["compat", "src/"],
|
||||||
|
"git-version": "git-version",
|
||||||
|
"stub": true
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "geoip2/geoip2",
|
"name": "geoip2/geoip2",
|
||||||
"description": "MaxMind GeoIP2 PHP API",
|
"description": "MaxMind GeoIP2 PHP API",
|
||||||
"keywords": [ "geoip", "geolocation", "maxmind" ],
|
"keywords": ["geoip", "geoip2", "geolocation", "ip", "maxmind"],
|
||||||
"homepage": "https://github.com/maxmind/GeoIP2-php",
|
"homepage": "https://github.com/maxmind/GeoIP2-php",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"guzzle/guzzle": "3.*",
|
"guzzle/guzzle": "3.*",
|
||||||
"maxmind-db/reader": "0.3.*",
|
"maxmind-db/reader": "~0.3.1",
|
||||||
"php": ">=5.3.1"
|
"php": ">=5.3.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
"psr-0": {
|
||||||
"GeoIp2": "src/",
|
"GeoIp2": "src/",
|
||||||
"" : "compat/"
|
"JsonSerializable": "compat/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Submodule maxmind-db updated: f7b9342b84...f887fec99e
17
phar-stub.php
Normal file
17
phar-stub.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once 'phar://geoip2.phar/vendor/autoload.php';
|
||||||
|
|
||||||
|
// The following was taken from Guzzle (MIT license)
|
||||||
|
|
||||||
|
// Copy the cacert.pem file from the phar if it is not in the temp folder.
|
||||||
|
$from = 'phar://geoip2.phar/vendor/guzzle/guzzle/src/Guzzle/Http/Resources/cacert.pem';
|
||||||
|
$certFile = sys_get_temp_dir() . '/guzzle-cacert.pem';
|
||||||
|
|
||||||
|
// Only copy when the file size is different
|
||||||
|
if (!file_exists($certFile) || filesize($certFile) != filesize($from)) {
|
||||||
|
if (!copy($from, $certFile)) {
|
||||||
|
throw new RuntimeException("Could not copy {$from} to {$certFile}: "
|
||||||
|
. var_export(error_get_last(), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user