I am trying to use Gdata package of Zend-2 framework to access Youtube API.
I have a successfully working version with Zend 1.9 version. I am trying to port them to Zend 2 framework version.
The folder structure is
C:\wamp\www\plugins\youtube\
C:\wamp\www\plugins\youtube\Zend\ (all default folders that comes with ZF2)
C:\wamp\www\plugins\youtube\Zend\ZendGData (downloaded separately from Zend Packages page)
I have added the path C:\wamp\www\plugins\youtube\ to the include_path by using set_include_path() function and have verified the same.
I am using the below code to create the YouTube object.
$yt = new ZendGData\YouTube();
I am getting the below error.
Class 'ZendGData\YouTube' not found
I am not how to use the auto-loading feature of ZF2. I tried to include the Loader/StandardAutoloader.php file. But still the same.
If I include the Zend\ZendGData\YouTube.php file I get the notice that the ZendGData\Media is not found.
Please let me know if I am missing something silly.
EDIT:
Some more information on what I have done now. Based on search from Stackoverflow site, I did the below changes.
use Zend\Loader\StandardAutoloader;
use ZendGdata\YouTube;
require_once 'C:\wamp\www\plugins\youtube\Zend\Loader\StandardAutoloader.php';
$loader = new StandardAutoloader(array('autoregister_zf' => true));
$loader->register();
$yt = new Zend\ZendGData\YouTube();
Now I get the below error.
Class 'ZendGData\Media' not found
After a lot of trial and error with the AutoLoader, the below code worked for me. If someone is having the same issue, here is the solution.
require_once 'C:\wamp\www\youtube\Zend\Loader\StandardAutoloader.php';
$loader = new StandardAutoloader(array(
'autoregister_zf' => true,
'namespaces' => array(
'ZendGData' => 'C:\wamp\www\youtube\Zend\ZendGdata\')
)
);
$loader->register();
$yt = new ZendGData\YouTube();