简体   繁体   中英

Laravel 5.4 using Geoip

I am trying to use the antonioribeiro/tracker package for Laravel, but in order to get geoip you have to either to install geoip v 1.14 or 2.

After installation I can't add a facade and alias in the configuration file. How can I fix this?.

My composer.json file

"require": {
    "php": ">=5.6.4",
    "geoip/geoip": "~1.14",
    "laravel/framework": "5.4.*",
    "laravel/tinker": "~1.0",
    "pragmarx/tracker": "^3.1"
},
"require-dev": {
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~5.7"
},

How do I add an alias and facade in the configuration file?

The geoip package is not a Laravel package. In order to have a facade or something similar, you'll need a Laravel wrapper or create it yourself.

Existing Laravel package: torann/laravel-geoip

Some basic usage information: laravel-geoip basic usage

Basically, after installing you can use the helper method geoip() , or you can choose to set a Facade, but it's not required.

Most of these packages use geoip2 , so you can remove "geoip/geoip": "~1.14", from your composer.json file. Including the package will also install geoip2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM