Struggle to use lib installed by Composer

Hi guys,

I am trying to use PushWoosh PHP lib ( and can not figure it out why Yii can not import classes correctly.

Here is my composer.json


    "require" : {

        "gomoob/php-pushwoosh": "~1.0"



which give me





In index.php, I do

require_once __DIR__ . '/vendor/autoload.php';


then in one of the controller,

  $pushwoosh = Pushwoosh::create()



and Yii complains about

PHP Warning: 

include(Pushwoosh.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory

#1 - unknown(0): YiiBase::autoload("Pushwoosh")

#2 - spl_autoload_call("Pushwoosh") 

I have no clues what else need to be done to make this work.

I did as suggested in , but it does not work.

I’m using Yii 1.1.16, PHP 5.3.27


You are probably missing some namespaces. Try the following

$pushwoosh = \Gomoob\Pushwoosh\Client\Pushwoosh::create()



If you’re using an editor like phpstorm, it should be able to find your classes

Hi Georaldc,

It works if I follow your guidance. But I have to do it for all classes in Gomoon Pushwoosh lib.

Why Yii can not understand that Pushwoosh::create() is \Gomoob\Pushwoosh\Client\Pushwoosh::create() ? And how do I fix this issue permanently ?

I don’t think you can do that. If you want to save yourself from writing the full namespace+class path over and over again, you can use an alias for all the 3rd party classes you’ll be using. At the top of your class file, you can put in the following:

use Gomoob\Pushwoosh\Client\Pushwoosh;

This should allow you to call the class the way you wanted to.

Thanks alot.

Just a note to people using namespace first time. Make sure you put "use Gomoob\Pushwoosh\Client\Pushwoosh;" at the very top and should not be in any class or function.