From 52b04ce8d24f25160c641f98a53b951b08dd8c21 Mon Sep 17 00:00:00 2001 From: Chris Deighton Date: Wed, 25 Jul 2018 22:31:37 +1200 Subject: [PATCH] Add `Serato\SwsApp\Slim\Middleware\GeoIpLookup` middleware --- .gitignore | 1 + composer.json | 3 +- phpunit.xml | 6 ++ src/Slim/Middleware/GeoIpLookup.php | 78 ++++++++++++++ tests/Slim/Middleware/GeoIpLookupTest.php | 120 ++++++++++++++++++++++ 5 files changed, 207 insertions(+), 1 deletion(-) create mode 100644 src/Slim/Middleware/GeoIpLookup.php create mode 100644 tests/Slim/Middleware/GeoIpLookupTest.php diff --git a/.gitignore b/.gitignore index d184464..59cb102 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ composer.lock /tests/reports debug.log error.log +GeoLite2-City.mmdb \ No newline at end of file diff --git a/composer.json b/composer.json index d0ded8e..6c28923 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,8 @@ "aws/aws-sdk-php": "^3.0", "propel/propel": "2.0.0-alpha7", "willdurand/negotiation": "~2.2.0", - "symfony/cache": "^3.0" + "symfony/cache": "^3.0", + "geoip2/geoip2": "^2.0.0" }, "require-dev": { "phpunit/phpunit": "~6.0", diff --git a/phpunit.xml b/phpunit.xml index 03d28d9..093ffb2 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -12,6 +12,12 @@ + + + geoip-database + + +