bug? console app - Class 'Guzzle\Http\Client' not found

Hi guys,

I have the following files

/trunk/common/extensions/Api/Api.php

/trunk/vendor/guzzle

and configs:

webapp config: /trunk/members/config/main.php




...

'components' => array(

        'api' => array(

            'class' => 'common.extensions.Api.Api'

        )

        ...

)

...



console config: /trunk/console/config/main.php




...

'components' => array(

        'api' => array(

            'class' => 'common.extensions.Api.Api'

        )

        ...

)

...



Api.php




use Guzzle\Http\Client;


class Api

{

...


    public function get($url) {

        $client = new Client;

    }




Client.php has namespace defined as follows:

namespace Guzzle\Http;

Guzzle was installed via composer.

— the problem:

When I run the API request via webapp, everything is ok

When I run the API via console app, following error is thrown PHP Fatal error: Class ‘Guzzle\Http\Client’ not found in /var/www/core/trunk/common/extensions/Api/Api.php on line 20

Any ideas what’s the problem? Is this a bug in console app?

thanks in advance!

Solution:

Api.php




require 'vendor/autoload.php'; // <-- I had to include this line so the class to be loaded

use Guzzle\Http\Client;


class Api

{ ....


}