phplaravelbuzz

Class 'Geocoder\HttpAdapter\BuzzHttpAdapter' not found


I installed the geocoder-php composer package using php composer.phar install. I'm running on PHP framework Laravel.

Loading composer repositories with package information
Installing dependencies
  - Installing willdurand/geocoder (1.0.10)
    Downloading: 100%

  - Installing kriswallsmith/buzz (v0.7)
    Downloading: 100%

willdurand/geocoder suggests installing guzzle/guzzle (Enabling Guzzle allows you to use the GuzzleHttpAdapter.)
willdurand/geocoder suggests installing zendframework/zend-http (Enabling Zend_Http allows you to use the ZendHttpAdapter)
Writing lock file
Generating autoload files

paths.php

// --------------------------------------------------------------
// The path to the composer vendors directory.
// --------------------------------------------------------------
$paths['composer'] = 'vendor';

public/index.php

// --------------------------------------------------------------
// Autoload composer vendors.
// --------------------------------------------------------------
require path('composer').DS.'autoload.php';

composer.json

{
    "require": {
        "willdurand/geocoder": "@stable",
        "kriswallsmith/buzz": "@stable"
    }
}

Problem: I get the following error when I try to run the example on Geocoder-php's homepage:

Error:

Class 'Geocoder\HttpAdapter\BuzzHttpAdapter' not found

Occurs at:

$adapter  = new \Geocoder\HttpAdapter\BuzzHttpAdapter();

Directory structure

enter image description here

I have already installed Buzz, did I miss out something?


Solution

  • You need to require the autoloader before it can work

    Try adding the following :

    require 'vendor/willdurand/Geocoder/autoload.php';