Вопрос

I am importing Guzzle library in a Yii project and getting error.

Way of importing

    Yii::import('application.vendor.Guzzle'); 
    require_once(Yii::getPathOfAlias('application.vendor.Guzzle.Http').'/Client.php');      
    $response = Guzzle::get('http://guzzlephp.org'); 

Error

    Fatal error: Class 'Guzzle\Common\AbstractHasDispatcher' not found in C:\wamp\www\yiiproject\protected\vendor\Guzzle\Http\Client.php
Это было полезно?

Решение

Try with

Yii::import('application.vendor.Guzzle.*');

Right now you are only importing 1 class. You are also including another but the rest of the classes are no where to be found because Yii does not know where to find them.

Better yet, use composer to get guzzle. Composer will create an autoload file that you can easily import with Yii and will in turn load everything else.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top