laravel - class GeoIP not found -
i have installed geoip laravel in laravel app instructed on: https://github.com/torann/laravel-geoip
but when try fetch vistors location using in controller so:
$location = geoip::getlocation();
i class geoip not dound exception though have included geoip class in controller as:
use geoip;
this composer.json require array:
"require": { "php": ">=5.5.9", "laravel/framework": "5.1.*", "laravelcollective/html": "~5.0", "matriphe/imageupload": "5.1.*", "illuminate/html": "5.0.*@dev", "gloudemans/shoppingcart": "~1.3", "jacopo/laravel-authentication-acl": "1.3.*", "cviebrock/laravel-elasticsearch": "^1.0", "elasticsearch/elasticsearch": "^2.1", "torann/geoip": "0.2.*@dev" },
my service providers array:
'providers' => array( 'torann\geoip\geoipserviceprovider', )
to aliases array:
'aliases' => array( 'geoip' => 'torann\geoip\geoipfacade', )
in short have correctly installed package. have tried inlcude geoip class as:
use torann\geoip;
but still class cannot found. please.
if using laravel 5.x, try include provider this:
torann\geoip\geoipserviceprovider::class,
and alias this:
'geoip' => torann\geoip\geoipfacade::class,
run composer update
after if necessary.
then in controller, make sure use geoip:
use geoip geoip;
hope helps you!
Comments
Post a Comment