1
0
mirror of https://github.com/cydrobolt/polr.git synced 2024-09-19 15:11:40 +02:00

Add GeoIP configurations and setup hooks for adv analytics

This commit is contained in:
Chaoyi Zha 2016-12-29 14:48:40 -05:00
parent b73048cdc0
commit 7d66e655fe
7 changed files with 522 additions and 88 deletions

View File

@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
* @var array * @var array
*/ */
protected $commands = [ protected $commands = [
// \Torann\GeoIP\Console\Update::class
]; ];
/** /**

View File

@ -6,8 +6,8 @@ use Illuminate\Http\Request;
class ClickHelper { class ClickHelper {
static private function getCountry($ip) { static private function getCountry($ip) {
// TODO $country_iso = geoip()->getLocation($ip)->iso_code;
return 'US'; return $country_iso;
} }
static private function getHost($url) { static private function getHost($url) {

View File

@ -33,6 +33,13 @@ class SetupController extends Controller {
return self::parseExitCode($exitCode); return self::parseExitCode($exitCode);
} }
private static function updateGeoIP() {
// Output GeoIP database for advanced
// analytics
$exitCode = Artisan::call('geoip:update', []);
return self::parseExitCode($exitCode);
}
private static function createDatabase() { private static function createDatabase() {
$exitCode = Artisan::call('migrate', [ $exitCode = Artisan::call('migrate', [
'--force' => true, '--force' => true,
@ -188,8 +195,8 @@ class SetupController extends Controller {
// our app key changes and Laravel encrypts cookies. // our app key changes and Laravel encrypts cookies.
setcookie('setup_arguments', $setup_finish_arguments, time()+60); setcookie('setup_arguments', $setup_finish_arguments, time()+60);
} }
fclose($handle);
fclose($handle);
return $response; return $response;
} }
@ -214,7 +221,14 @@ class SetupController extends Controller {
$database_created = self::createDatabase(); $database_created = self::createDatabase();
if (!$database_created) { if (!$database_created) {
return redirect(route('setup'))->with('error', 'Could not create database. Perhaps some credentials were incorrect?'); return redirect(route('setup'))->with('error', 'Could not create database. Perhaps your credentials were incorrect?');
}
if (env('SETTING_ADV_ANALYTICS')) {
$geoip_db_created = self::updateGeoIP();
if (!$geoip_db_created) {
return redirect(route('setup'))->with('error', 'Could not fetch GeoIP database for advanced analytics. Perhaps your server is not connected to the internet?');
}
} }
$user = UserFactory::createUser($setup_finish_args->acct_username, $setup_finish_args->acct_email, $setup_finish_args->acct_password, 1, $request->ip(), false, 0, UserHelper::$USER_ROLES['admin']); $user = UserFactory::createUser($setup_finish_args->acct_username, $setup_finish_args->acct_email, $setup_finish_args->acct_password, 1, $request->ip(), false, 0, UserHelper::$USER_ROLES['admin']);

View File

@ -20,9 +20,10 @@ $app = new Laravel\Lumen\Application(
); );
$app->withFacades(); $app->withFacades();
$app->withEloquent(); $app->withEloquent();
$app->configure('geoip');
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Register Container Bindings | Register Container Bindings
@ -79,7 +80,8 @@ $app->middleware([
*/ */
$app->register(App\Providers\AppServiceProvider::class); $app->register(App\Providers\AppServiceProvider::class);
$app->register(Yajra\Datatables\DatatablesServiceProvider::class); $app->register(\Yajra\Datatables\DatatablesServiceProvider::class);
$app->register(\Torann\GeoIP\GeoIPServiceProvider::class);
// $app->register(App\Providers\EventServiceProvider::class); // $app->register(App\Providers\EventServiceProvider::class);
/* /*

View File

@ -10,7 +10,9 @@
"vlucas/phpdotenv": "~1.0", "vlucas/phpdotenv": "~1.0",
"illuminate/mail": "~5.1", "illuminate/mail": "~5.1",
"yajra/laravel-datatables-oracle": "~6.0", "yajra/laravel-datatables-oracle": "~6.0",
"paragonie/random_compat": "^1.0.6" "paragonie/random_compat": "^1.0.6",
"torann/geoip": "^1.0",
"geoip2/geoip2": "^2.4"
}, },
"require-dev": { "require-dev": {
"fzaninotto/faker": "~1.0", "fzaninotto/faker": "~1.0",

433
composer.lock generated
View File

@ -4,8 +4,66 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "c9b3d1fae340ed50d76dbc8c5ec73ab2", "content-hash": "4a670b1f52a5d12a2e5a8bf5074fd05d",
"packages": [ "packages": [
{
"name": "composer/ca-bundle",
"version": "1.0.6",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
"reference": "a795611394b3c05164fd0eb291b492b39339cba4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/a795611394b3c05164fd0eb291b492b39339cba4",
"reference": "a795611394b3c05164fd0eb291b492b39339cba4",
"shasum": ""
},
"require": {
"ext-openssl": "*",
"ext-pcre": "*",
"php": "^5.3.2 || ^7.0"
},
"require-dev": {
"psr/log": "^1.0",
"symfony/process": "^2.5 || ^3.0"
},
"suggest": {
"symfony/process": "This is necessary to reliably check whether openssl_x509_parse is vulnerable on older php versions, but can be ignored on PHP 5.5.6+"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\CaBundle\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
"keywords": [
"cabundle",
"cacert",
"certificate",
"ssl",
"tls"
],
"time": "2016-11-02T18:11:27+00:00"
},
{ {
"name": "danielstjules/stringy", "name": "danielstjules/stringy",
"version": "1.10.0", "version": "1.10.0",
@ -60,7 +118,7 @@
"utility", "utility",
"utils" "utils"
], ],
"time": "2015-07-23 00:54:12" "time": "2015-07-23T00:54:12+00:00"
}, },
{ {
"name": "doctrine/inflector", "name": "doctrine/inflector",
@ -127,7 +185,7 @@
"singularize", "singularize",
"string" "string"
], ],
"time": "2015-11-06 14:35:42" "time": "2015-11-06T14:35:42+00:00"
}, },
{ {
"name": "dompdf/dompdf", "name": "dompdf/dompdf",
@ -168,7 +226,58 @@
], ],
"description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
"homepage": "https://github.com/dompdf/dompdf", "homepage": "https://github.com/dompdf/dompdf",
"time": "2015-12-07 04:07:13" "time": "2015-12-07T04:07:13+00:00"
},
{
"name": "geoip2/geoip2",
"version": "v2.4.4",
"source": {
"type": "git",
"url": "https://github.com/maxmind/GeoIP2-php.git",
"reference": "57e0384a83d0935db4c4cdb3f411aa131481ae80"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/57e0384a83d0935db4c4cdb3f411aa131481ae80",
"reference": "57e0384a83d0935db4c4cdb3f411aa131481ae80",
"shasum": ""
},
"require": {
"maxmind-db/reader": "~1.0",
"maxmind/web-service-common": "~0.3",
"php": ">=5.3.1"
},
"require-dev": {
"phpunit/phpunit": "4.2.*",
"squizlabs/php_codesniffer": "2.*"
},
"type": "library",
"autoload": {
"psr-4": {
"GeoIp2\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Gregory J. Oschwald",
"email": "goschwald@maxmind.com",
"homepage": "http://www.maxmind.com/"
}
],
"description": "MaxMind GeoIP2 PHP API",
"homepage": "https://github.com/maxmind/GeoIP2-php",
"keywords": [
"IP",
"geoip",
"geoip2",
"geolocation",
"maxmind"
],
"time": "2016-10-11T21:58:42+00:00"
}, },
{ {
"name": "illuminate/auth", "name": "illuminate/auth",
@ -218,7 +327,7 @@
], ],
"description": "The Illuminate Auth package.", "description": "The Illuminate Auth package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-08 14:38:44" "time": "2015-12-08T14:38:44+00:00"
}, },
{ {
"name": "illuminate/broadcasting", "name": "illuminate/broadcasting",
@ -265,7 +374,7 @@
], ],
"description": "The Illuminate Broadcasting package.", "description": "The Illuminate Broadcasting package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-21 04:33:22" "time": "2015-12-21T04:33:22+00:00"
}, },
{ {
"name": "illuminate/bus", "name": "illuminate/bus",
@ -310,7 +419,7 @@
], ],
"description": "The Illuminate Bus package.", "description": "The Illuminate Bus package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-24 19:50:28" "time": "2015-12-24T19:50:28+00:00"
}, },
{ {
"name": "illuminate/cache", "name": "illuminate/cache",
@ -360,7 +469,7 @@
], ],
"description": "The Illuminate Cache package.", "description": "The Illuminate Cache package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-28 21:20:38" "time": "2015-12-28T21:20:38+00:00"
}, },
{ {
"name": "illuminate/config", "name": "illuminate/config",
@ -405,7 +514,7 @@
], ],
"description": "The Illuminate Config package.", "description": "The Illuminate Config package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-06-18 02:16:31" "time": "2015-06-18T02:16:31+00:00"
}, },
{ {
"name": "illuminate/console", "name": "illuminate/console",
@ -456,7 +565,7 @@
], ],
"description": "The Illuminate Console package.", "description": "The Illuminate Console package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-28 21:10:29" "time": "2015-12-28T21:10:29+00:00"
}, },
{ {
"name": "illuminate/container", "name": "illuminate/container",
@ -499,7 +608,7 @@
], ],
"description": "The Illuminate Container package.", "description": "The Illuminate Container package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-07 20:20:37" "time": "2015-12-07T20:20:37+00:00"
}, },
{ {
"name": "illuminate/contracts", "name": "illuminate/contracts",
@ -541,7 +650,7 @@
], ],
"description": "The Illuminate Contracts package.", "description": "The Illuminate Contracts package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-09-24 11:16:48" "time": "2015-09-24T11:16:48+00:00"
}, },
{ {
"name": "illuminate/cookie", "name": "illuminate/cookie",
@ -587,7 +696,7 @@
], ],
"description": "The Illuminate Cookie package.", "description": "The Illuminate Cookie package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-05 16:40:16" "time": "2015-12-05T16:40:16+00:00"
}, },
{ {
"name": "illuminate/database", "name": "illuminate/database",
@ -647,7 +756,7 @@
"orm", "orm",
"sql" "sql"
], ],
"time": "2015-12-30 23:14:26" "time": "2015-12-30T23:14:26+00:00"
}, },
{ {
"name": "illuminate/encryption", "name": "illuminate/encryption",
@ -696,7 +805,7 @@
], ],
"description": "The Illuminate Encryption package.", "description": "The Illuminate Encryption package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-02 19:57:45" "time": "2015-12-02T19:57:45+00:00"
}, },
{ {
"name": "illuminate/events", "name": "illuminate/events",
@ -741,7 +850,7 @@
], ],
"description": "The Illuminate Events package.", "description": "The Illuminate Events package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-11-29 16:58:05" "time": "2015-11-29T16:58:05+00:00"
}, },
{ {
"name": "illuminate/filesystem", "name": "illuminate/filesystem",
@ -791,7 +900,7 @@
], ],
"description": "The Illuminate Filesystem package.", "description": "The Illuminate Filesystem package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-20 15:51:01" "time": "2015-12-20T15:51:01+00:00"
}, },
{ {
"name": "illuminate/hashing", "name": "illuminate/hashing",
@ -835,7 +944,7 @@
], ],
"description": "The Illuminate Hashing package.", "description": "The Illuminate Hashing package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-11-29 16:58:05" "time": "2015-11-29T16:58:05+00:00"
}, },
{ {
"name": "illuminate/http", "name": "illuminate/http",
@ -881,7 +990,7 @@
], ],
"description": "The Illuminate Http package.", "description": "The Illuminate Http package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-19 22:27:14" "time": "2015-12-19T22:27:14+00:00"
}, },
{ {
"name": "illuminate/mail", "name": "illuminate/mail",
@ -932,7 +1041,7 @@
], ],
"description": "The Illuminate Mail package.", "description": "The Illuminate Mail package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-05 16:21:24" "time": "2015-12-05T16:21:24+00:00"
}, },
{ {
"name": "illuminate/pagination", "name": "illuminate/pagination",
@ -976,7 +1085,7 @@
], ],
"description": "The Illuminate Pagination package.", "description": "The Illuminate Pagination package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-07 19:40:09" "time": "2015-12-07T19:40:09+00:00"
}, },
{ {
"name": "illuminate/pipeline", "name": "illuminate/pipeline",
@ -1020,7 +1129,7 @@
], ],
"description": "The Illuminate Pipeline package.", "description": "The Illuminate Pipeline package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-10-05 21:58:27" "time": "2015-10-05T21:58:27+00:00"
}, },
{ {
"name": "illuminate/queue", "name": "illuminate/queue",
@ -1078,7 +1187,7 @@
], ],
"description": "The Illuminate Queue package.", "description": "The Illuminate Queue package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-28 15:52:33" "time": "2015-12-28T15:52:33+00:00"
}, },
{ {
"name": "illuminate/routing", "name": "illuminate/routing",
@ -1133,7 +1242,7 @@
], ],
"description": "The Illuminate Routing package.", "description": "The Illuminate Routing package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2016-07-22 13:25:32" "time": "2016-07-22T13:25:32+00:00"
}, },
{ {
"name": "illuminate/session", "name": "illuminate/session",
@ -1183,7 +1292,7 @@
], ],
"description": "The Illuminate Session package.", "description": "The Illuminate Session package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-26 15:27:27" "time": "2015-12-26T15:27:27+00:00"
}, },
{ {
"name": "illuminate/support", "name": "illuminate/support",
@ -1237,7 +1346,7 @@
], ],
"description": "The Illuminate Support package.", "description": "The Illuminate Support package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-28 21:10:29" "time": "2015-12-28T21:10:29+00:00"
}, },
{ {
"name": "illuminate/translation", "name": "illuminate/translation",
@ -1282,7 +1391,7 @@
], ],
"description": "The Illuminate Translation package.", "description": "The Illuminate Translation package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-11-28 13:59:02" "time": "2015-11-28T13:59:02+00:00"
}, },
{ {
"name": "illuminate/validation", "name": "illuminate/validation",
@ -1332,7 +1441,7 @@
], ],
"description": "The Illuminate Validation package.", "description": "The Illuminate Validation package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-12-09 15:24:53" "time": "2015-12-09T15:24:53+00:00"
}, },
{ {
"name": "illuminate/view", "name": "illuminate/view",
@ -1379,7 +1488,7 @@
], ],
"description": "The Illuminate View package.", "description": "The Illuminate View package.",
"homepage": "http://laravel.com", "homepage": "http://laravel.com",
"time": "2015-11-29 16:58:05" "time": "2015-11-29T16:58:05+00:00"
}, },
{ {
"name": "laravel/lumen-framework", "name": "laravel/lumen-framework",
@ -1465,7 +1574,7 @@
"laravel", "laravel",
"lumen" "lumen"
], ],
"time": "2015-10-28 22:19:15" "time": "2015-10-28T22:19:15+00:00"
}, },
{ {
"name": "laravelcollective/html", "name": "laravelcollective/html",
@ -1515,7 +1624,7 @@
"email": "adam@laravelcollective.com" "email": "adam@laravelcollective.com"
} }
], ],
"time": "2015-11-28 08:27:09" "time": "2015-11-28T08:27:09+00:00"
}, },
{ {
"name": "league/fractal", "name": "league/fractal",
@ -1578,7 +1687,7 @@
"league", "league",
"rest" "rest"
], ],
"time": "2016-07-21 09:56:14" "time": "2016-07-21T09:56:14+00:00"
}, },
{ {
"name": "maatwebsite/excel", "name": "maatwebsite/excel",
@ -1645,7 +1754,106 @@
"import", "import",
"laravel" "laravel"
], ],
"time": "2016-09-15 21:03:21" "time": "2016-09-15T21:03:21+00:00"
},
{
"name": "maxmind-db/reader",
"version": "v1.1.2",
"source": {
"type": "git",
"url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
"reference": "571279051c3339414dc91b422fb61af540c3431d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/571279051c3339414dc91b422fb61af540c3431d",
"reference": "571279051c3339414dc91b422fb61af540c3431d",
"shasum": ""
},
"require": {
"php": ">=5.3.1"
},
"require-dev": {
"phpunit/phpunit": "4.2.*",
"satooshi/php-coveralls": "1.0.*",
"squizlabs/php_codesniffer": "2.*"
},
"suggest": {
"ext-bcmath": "bcmath or gmp is requred for decoding larger integers with the pure PHP decoder",
"ext-gmp": "bcmath or gmp is requred for decoding larger integers with the pure PHP decoder",
"ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
},
"type": "library",
"autoload": {
"psr-4": {
"MaxMind\\Db\\": "src/MaxMind/Db"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Gregory J. Oschwald",
"email": "goschwald@maxmind.com",
"homepage": "http://www.maxmind.com/"
}
],
"description": "MaxMind DB Reader API",
"homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php",
"keywords": [
"database",
"geoip",
"geoip2",
"geolocation",
"maxmind"
],
"time": "2016-11-21T21:33:24+00:00"
},
{
"name": "maxmind/web-service-common",
"version": "v0.3.1",
"source": {
"type": "git",
"url": "https://github.com/maxmind/web-service-common-php.git",
"reference": "1fe780bcd6a9038b7e36b13fa0aeeeeca4cdb0a4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/1fe780bcd6a9038b7e36b13fa0aeeeeca4cdb0a4",
"reference": "1fe780bcd6a9038b7e36b13fa0aeeeeca4cdb0a4",
"shasum": ""
},
"require": {
"composer/ca-bundle": "^1.0.3",
"ext-curl": "*",
"ext-json": "*",
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "4.*",
"squizlabs/php_codesniffer": "2.*"
},
"type": "library",
"autoload": {
"psr-4": {
"MaxMind\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Gregory Oschwald",
"email": "goschwald@maxmind.com"
}
],
"description": "Internal MaxMind Web Service API",
"homepage": "https://github.com/maxmind/mm-web-service-api-php",
"time": "2016-08-18T16:36:52+00:00"
}, },
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
@ -1722,7 +1930,7 @@
"logging", "logging",
"psr-3" "psr-3"
], ],
"time": "2015-10-14 12:51:02" "time": "2015-10-14T12:51:02+00:00"
}, },
{ {
"name": "mtdowling/cron-expression", "name": "mtdowling/cron-expression",
@ -1766,7 +1974,7 @@
"cron", "cron",
"schedule" "schedule"
], ],
"time": "2016-01-26 21:23:30" "time": "2016-01-26T21:23:30+00:00"
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
@ -1813,7 +2021,7 @@
"datetime", "datetime",
"time" "time"
], ],
"time": "2015-11-04 20:07:17" "time": "2015-11-04T20:07:17+00:00"
}, },
{ {
"name": "nikic/fast-route", "name": "nikic/fast-route",
@ -1856,7 +2064,7 @@
"router", "router",
"routing" "routing"
], ],
"time": "2015-02-26 15:33:07" "time": "2015-02-26T15:33:07+00:00"
}, },
{ {
"name": "paragonie/random_compat", "name": "paragonie/random_compat",
@ -1904,7 +2112,7 @@
"pseudorandom", "pseudorandom",
"random" "random"
], ],
"time": "2016-03-18 20:34:03" "time": "2016-03-18T20:34:03+00:00"
}, },
{ {
"name": "phenx/php-font-lib", "name": "phenx/php-font-lib",
@ -1938,7 +2146,7 @@
], ],
"description": "A library to read, parse, export and make subsets of different types of font files.", "description": "A library to read, parse, export and make subsets of different types of font files.",
"homepage": "https://github.com/PhenX/php-font-lib", "homepage": "https://github.com/PhenX/php-font-lib",
"time": "2014-02-01 15:22:28" "time": "2014-02-01T15:22:28+00:00"
}, },
{ {
"name": "phpoffice/phpexcel", "name": "phpoffice/phpexcel",
@ -1995,7 +2203,7 @@
"xls", "xls",
"xlsx" "xlsx"
], ],
"time": "2015-05-01 07:00:55" "time": "2015-05-01T07:00:55+00:00"
}, },
{ {
"name": "psr/log", "name": "psr/log",
@ -2033,7 +2241,7 @@
"psr", "psr",
"psr-3" "psr-3"
], ],
"time": "2012-12-21 11:40:51" "time": "2012-12-21T11:40:51+00:00"
}, },
{ {
"name": "swiftmailer/swiftmailer", "name": "swiftmailer/swiftmailer",
@ -2086,7 +2294,7 @@
"mail", "mail",
"mailer" "mailer"
], ],
"time": "2015-06-06 14:19:39" "time": "2015-06-06T14:19:39+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
@ -2145,7 +2353,7 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-01-14 08:26:43" "time": "2016-01-14T08:26:43+00:00"
}, },
{ {
"name": "symfony/css-selector", "name": "symfony/css-selector",
@ -2198,7 +2406,7 @@
], ],
"description": "Symfony CssSelector Component", "description": "Symfony CssSelector Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-01-27 05:14:46" "time": "2016-01-27T05:14:46+00:00"
}, },
{ {
"name": "symfony/debug", "name": "symfony/debug",
@ -2255,7 +2463,7 @@
], ],
"description": "Symfony Debug Component", "description": "Symfony Debug Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-01-13 10:28:07" "time": "2016-01-13T10:28:07+00:00"
}, },
{ {
"name": "symfony/dom-crawler", "name": "symfony/dom-crawler",
@ -2310,7 +2518,7 @@
], ],
"description": "Symfony DomCrawler Component", "description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-01-03 15:32:00" "time": "2016-01-03T15:32:00+00:00"
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
@ -2370,7 +2578,7 @@
], ],
"description": "Symfony EventDispatcher Component", "description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-01-13 10:28:07" "time": "2016-01-13T10:28:07+00:00"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
@ -2419,7 +2627,7 @@
], ],
"description": "Symfony Finder Component", "description": "Symfony Finder Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-01-14 08:26:43" "time": "2016-01-14T08:26:43+00:00"
}, },
{ {
"name": "symfony/http-foundation", "name": "symfony/http-foundation",
@ -2474,7 +2682,7 @@
], ],
"description": "Symfony HttpFoundation Component", "description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-01-13 10:26:43" "time": "2016-01-13T10:26:43+00:00"
}, },
{ {
"name": "symfony/http-kernel", "name": "symfony/http-kernel",
@ -2556,7 +2764,7 @@
], ],
"description": "Symfony HttpKernel Component", "description": "Symfony HttpKernel Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-01-14 10:41:45" "time": "2016-01-14T10:41:45+00:00"
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
@ -2605,7 +2813,7 @@
], ],
"description": "Symfony Process Component", "description": "Symfony Process Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-01-06 09:57:37" "time": "2016-01-06T09:57:37+00:00"
}, },
{ {
"name": "symfony/routing", "name": "symfony/routing",
@ -2679,7 +2887,7 @@
"uri", "uri",
"url" "url"
], ],
"time": "2016-08-16 10:55:04" "time": "2016-08-16T10:55:04+00:00"
}, },
{ {
"name": "symfony/security-core", "name": "symfony/security-core",
@ -2744,7 +2952,7 @@
], ],
"description": "Symfony Security Component - Core Library", "description": "Symfony Security Component - Core Library",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-01-14 09:08:21" "time": "2016-01-14T09:08:21+00:00"
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
@ -2807,7 +3015,7 @@
], ],
"description": "Symfony Translation Component", "description": "Symfony Translation Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-01-03 15:32:00" "time": "2016-01-03T15:32:00+00:00"
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
@ -2866,7 +3074,7 @@
"debug", "debug",
"dump" "dump"
], ],
"time": "2016-01-07 11:12:32" "time": "2016-01-07T11:12:32+00:00"
}, },
{ {
"name": "tijsverkoyen/css-to-inline-styles", "name": "tijsverkoyen/css-to-inline-styles",
@ -2913,7 +3121,72 @@
], ],
"description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.",
"homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles",
"time": "2015-12-08 16:14:14" "time": "2015-12-08T16:14:14+00:00"
},
{
"name": "torann/geoip",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/Torann/laravel-geoip.git",
"reference": "ae77f4ad99926fa35c89378f00a6a7295a7246ea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Torann/laravel-geoip/zipball/ae77f4ad99926fa35c89378f00a6a7295a7246ea",
"reference": "ae77f4ad99926fa35c89378f00a6a7295a7246ea",
"shasum": ""
},
"require": {
"illuminate/console": "~5.0",
"illuminate/support": "~5.0",
"php": ">=5.5.9"
},
"require-dev": {
"geoip2/geoip2": "~2.1",
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^4.8"
},
"suggest": {
"geoip2/geoip2": "Required to use the MaxMind database or web service with GeoIP (~2.1).",
"monolog/monolog": "Allows for storing location not found errors to the log"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Torann\\GeoIP\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD 2-Clause"
],
"authors": [
{
"name": "Daniel Stainback",
"email": "torann@gmail.com"
}
],
"description": "Support for multiple GeoIP services.",
"keywords": [
"IP API",
"geoip",
"geolocation",
"infoDB",
"laravel",
"laravel 5",
"location",
"maxmind"
],
"time": "2016-10-17T17:29:40+00:00"
}, },
{ {
"name": "vlucas/phpdotenv", "name": "vlucas/phpdotenv",
@ -2959,7 +3232,7 @@
"env", "env",
"environment" "environment"
], ],
"time": "2015-05-30 15:59:26" "time": "2015-05-30T15:59:26+00:00"
}, },
{ {
"name": "yajra/laravel-datatables-oracle", "name": "yajra/laravel-datatables-oracle",
@ -3019,7 +3292,7 @@
"laravel4", "laravel4",
"laravel5" "laravel5"
], ],
"time": "2016-08-10 00:31:22" "time": "2016-08-10T00:31:22+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@ -3075,7 +3348,7 @@
"constructor", "constructor",
"instantiate" "instantiate"
], ],
"time": "2015-06-14 21:17:01" "time": "2015-06-14T21:17:01+00:00"
}, },
{ {
"name": "fzaninotto/faker", "name": "fzaninotto/faker",
@ -3127,7 +3400,7 @@
"faker", "faker",
"fixtures" "fixtures"
], ],
"time": "2015-05-29 06:29:14" "time": "2015-05-29T06:29:14+00:00"
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
@ -3169,7 +3442,7 @@
"object", "object",
"object graph" "object graph"
], ],
"time": "2015-11-07 22:20:37" "time": "2015-11-07T22:20:37+00:00"
}, },
{ {
"name": "phpdocumentor/reflection-docblock", "name": "phpdocumentor/reflection-docblock",
@ -3218,7 +3491,7 @@
"email": "mike.vanriel@naenius.com" "email": "mike.vanriel@naenius.com"
} }
], ],
"time": "2015-02-03 12:10:50" "time": "2015-02-03T12:10:50+00:00"
}, },
{ {
"name": "phpspec/prophecy", "name": "phpspec/prophecy",
@ -3278,7 +3551,7 @@
"spy", "spy",
"stub" "stub"
], ],
"time": "2015-08-13 10:07:40" "time": "2015-08-13T10:07:40+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@ -3341,7 +3614,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2016-02-13 06:47:56" "time": "2016-02-13T06:47:56+00:00"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",
@ -3388,7 +3661,7 @@
"filesystem", "filesystem",
"iterator" "iterator"
], ],
"time": "2015-06-21 13:08:43" "time": "2015-06-21T13:08:43+00:00"
}, },
{ {
"name": "phpunit/php-text-template", "name": "phpunit/php-text-template",
@ -3429,7 +3702,7 @@
"keywords": [ "keywords": [
"template" "template"
], ],
"time": "2015-06-21 13:50:34" "time": "2015-06-21T13:50:34+00:00"
}, },
{ {
"name": "phpunit/php-timer", "name": "phpunit/php-timer",
@ -3470,7 +3743,7 @@
"keywords": [ "keywords": [
"timer" "timer"
], ],
"time": "2015-06-21 08:01:12" "time": "2015-06-21T08:01:12+00:00"
}, },
{ {
"name": "phpunit/php-token-stream", "name": "phpunit/php-token-stream",
@ -3519,7 +3792,7 @@
"keywords": [ "keywords": [
"tokenizer" "tokenizer"
], ],
"time": "2015-09-15 10:49:45" "time": "2015-09-15T10:49:45+00:00"
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
@ -3593,7 +3866,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2016-02-13 06:58:29" "time": "2016-02-13T06:58:29+00:00"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
@ -3649,7 +3922,7 @@
"mock", "mock",
"xunit" "xunit"
], ],
"time": "2015-12-08 08:47:06" "time": "2015-12-08T08:47:06+00:00"
}, },
{ {
"name": "sebastian/code-unit-reverse-lookup", "name": "sebastian/code-unit-reverse-lookup",
@ -3694,7 +3967,7 @@
], ],
"description": "Looks up which function or method a line of code belongs to", "description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"time": "2016-02-13 06:45:14" "time": "2016-02-13T06:45:14+00:00"
}, },
{ {
"name": "sebastian/comparator", "name": "sebastian/comparator",
@ -3758,7 +4031,7 @@
"compare", "compare",
"equality" "equality"
], ],
"time": "2015-07-26 15:48:44" "time": "2015-07-26T15:48:44+00:00"
}, },
{ {
"name": "sebastian/diff", "name": "sebastian/diff",
@ -3810,7 +4083,7 @@
"keywords": [ "keywords": [
"diff" "diff"
], ],
"time": "2015-12-08 07:14:41" "time": "2015-12-08T07:14:41+00:00"
}, },
{ {
"name": "sebastian/environment", "name": "sebastian/environment",
@ -3860,7 +4133,7 @@
"environment", "environment",
"hhvm" "hhvm"
], ],
"time": "2015-12-02 08:37:27" "time": "2015-12-02T08:37:27+00:00"
}, },
{ {
"name": "sebastian/exporter", "name": "sebastian/exporter",
@ -3926,7 +4199,7 @@
"export", "export",
"exporter" "exporter"
], ],
"time": "2015-06-21 07:55:53" "time": "2015-06-21T07:55:53+00:00"
}, },
{ {
"name": "sebastian/global-state", "name": "sebastian/global-state",
@ -3977,7 +4250,7 @@
"keywords": [ "keywords": [
"global state" "global state"
], ],
"time": "2015-10-12 03:26:01" "time": "2015-10-12T03:26:01+00:00"
}, },
{ {
"name": "sebastian/recursion-context", "name": "sebastian/recursion-context",
@ -4030,7 +4303,7 @@
], ],
"description": "Provides functionality to recursively process PHP variables", "description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context", "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2015-11-11 19:50:13" "time": "2015-11-11T19:50:13+00:00"
}, },
{ {
"name": "sebastian/resource-operations", "name": "sebastian/resource-operations",
@ -4072,7 +4345,7 @@
], ],
"description": "Provides a list of PHP built-in functions that operate on resources", "description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations", "homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"time": "2015-07-28 20:34:47" "time": "2015-07-28T20:34:47+00:00"
}, },
{ {
"name": "sebastian/version", "name": "sebastian/version",
@ -4115,7 +4388,7 @@
], ],
"description": "Library that helps with managing the version number of Git-hosted PHP projects", "description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version", "homepage": "https://github.com/sebastianbergmann/version",
"time": "2016-02-04 12:56:52" "time": "2016-02-04T12:56:52+00:00"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
@ -4164,7 +4437,7 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-02-02 13:44:19" "time": "2016-02-02T13:44:19+00:00"
} }
], ],
"aliases": [], "aliases": [],

143
config/geoip.php Normal file
View File

@ -0,0 +1,143 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Logging Configuration
|--------------------------------------------------------------------------
|
| Here you may configure the log settings for when a location is not found
| for the IP provided.
|
*/
'log_failures' => true,
/*
|--------------------------------------------------------------------------
| Include Currency in Results
|--------------------------------------------------------------------------
|
| When enabled the system will do it's best in deciding the user's currency
| by matching their ISO code to a preset list of currencies.
|
*/
'include_currency' => true,
/*
|--------------------------------------------------------------------------
| Default Service
|--------------------------------------------------------------------------
|
| Here you may specify the default storage driver that should be used
| by the framework.
|
| Supported: "maxmind_database", "maxmind_api", "ipapi"
|
*/
'service' => 'maxmind_database',
/*
|--------------------------------------------------------------------------
| Storage Specific Configuration
|--------------------------------------------------------------------------
|
| Here you may configure as many storage drivers as you wish.
|
*/
'services' => [
'maxmind_database' => [
'class' => \Torann\GeoIP\Services\MaxMindDatabase::class,
'database_path' => storage_path('app/geoip.mmdb'),
'update_url' => 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz',
'locales' => ['en'],
],
'maxmind_api' => [
'class' => \Torann\GeoIP\Services\MaxMindWebService::class,
'user_id' => env('MAXMIND_USER_ID'),
'license_key' => env('MAXMIND_LICENSE_KEY'),
'locales' => ['en'],
],
'ipapi' => [
'class' => \Torann\GeoIP\Services\IPApi::class,
'secure' => true,
'key' => env('IPAPI_KEY'),
'continent_path' => storage_path('app/continents.json'),
],
],
/*
|--------------------------------------------------------------------------
| Default Cache Driver
|--------------------------------------------------------------------------
|
| Here you may specify the type of caching that should be used
| by the package.
|
| Options:
|
| all - All location are cached
| some - Cache only the requesting user
| none - Disable cached
|
*/
'cache' => 'none',
/*
|--------------------------------------------------------------------------
| Cache Tags
|--------------------------------------------------------------------------
|
| Cache tags are not supported when using the file or database cache
| drivers in Laravel. This is done so that only locations can be cleared.
|
*/
// 'cache_tags' => ['torann-geoip-location'],
/*
|--------------------------------------------------------------------------
| Cache Expiration
|--------------------------------------------------------------------------
|
| Define how long cached location are valid.
|
*/
'cache_expires' => 30,
/*
|--------------------------------------------------------------------------
| Default Location
|--------------------------------------------------------------------------
|
| Return when a location is not found.
|
*/
'default_location' => [
'ip' => '127.0.0.0',
'iso_code' => 'US',
'country' => 'United States',
'city' => 'New Haven',
'state' => 'CT',
'state_name' => 'Connecticut',
'postal_code' => '06510',
'lat' => 41.31,
'lon' => -72.92,
'timezone' => 'America/New_York',
'continent' => 'NA',
'default' => true,
'currency' => 'USD',
],
];