1

使用php composer.phar install. _ 我在 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

路径.php

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

公共/index.php

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

作曲家.json

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

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

错误:

Class 'Geocoder\HttpAdapter\BuzzHttpAdapter' not found

发生在:

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

目录结构

在此处输入图像描述

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

4

1 回答 1

1

您需要自动加载器才能工作

尝试添加以下内容:

require 'vendor/willdurand/Geocoder/autoload.php';
于 2012-09-23T23:48:52.303 回答