Class frontend\models\SoapClient' not found

Yii 2.09 is complaining about not finding SoapClient class whenever it gets to this statement.

$soapTest = new SoapClient(‘’);

Can someone tell me what I am doing wrong? Here is some info.

  • This error happens in the browser and the command line.

  • Soap extension is enabled in php.ini for web browser (using Apache) and CLI.

  • The same code works perfectly outside of Yii from the command line or browser.

  • OS: Windows 7;

  • Webserver: WAMP 2.5

  • PHP: 5.6.13

Thanks for your help.

Try putting backslash before SoapClient, e.g:

$soapTest = new \SoapClient('');

That was it! Problem solved. Thank you very much!