未找到“Geocoder \ HttpAdapter \ BuzzHttpAdapter”类

时间:2012-09-23 23:37:12

标签: php laravel buzz

我使用php composer.phar install安装了geocoder-php编辑器包。我正在运行PHP框架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';

公开/ index.php的

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

composer.json

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

问题:当我尝试在Geocoder-php的主页上运行示例时出现以下错误:

错误:

Class 'Geocoder\HttpAdapter\BuzzHttpAdapter' not found

发生在:

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

目录结构

enter image description here

我已经安装了Buzz,我错过了什么吗?

1 个答案:

答案 0 :(得分:1)

您需要先使用自动加载器

尝试添加以下内容:

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