Frage

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
War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top