0

I am newbie for Zend and as well for Piwik. I want to use piwik library for zend into my ZF2 application.

But the problem is piwik library for zend is built in ZF1 and my application is in ZF2.

I have check this solution to use ZF1 library in ZF2 but it is not working for me.

My init_autoloader.php is slightly different within the if($zf2Path){ statement:

if ($zf2Path && !class_exists('Zend\Loader\AutoloaderFactory')) {
    if (isset($loader)) {
        $loader->add('Zend', $zf2Path);
        $loader->add('ZendXml', $zf2Path);      
    } else {
        include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
        Zend\Loader\AutoloaderFactory::factory(array(
            'Zend\Loader\StandardAutoloader' => array(
                'autoregister_zf' => true,
            )
        ));
    }
}

and I have changed if($zf2Path){ statement: part of init_autoloader.php like this

if ($zf2Path && !class_exists('Zend\Loader\AutoloaderFactory')) {
    if (isset($loader)) {
        $loader->add('Zend', $zf2Path);
        $loader->add('ZendXml', $zf2Path);
    } else {
        include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';

        set_include_path(implode(PATH_SEPARATOR, array($zf1Path, get_include_path())));
        Zend\Loader\AutoloaderFactory::factory(array(
            'Zend\Loader\StandardAutoloader' => array(
                'autoregister_zf' => true,
                'prefixes' => array(
                    'Zend_' => $zf1Path . '/Zend'
                ),
            )
        ));
    }
}

So can anybody help me with this?

Sohil Desai
  • 2,940
  • 5
  • 23
  • 35

1 Answers1

0

There is a Zend Framework 2 integration here: https://github.com/heiglandreas/piwik

Matthieu Napoli
  • 48,448
  • 45
  • 173
  • 261