Search code examples
phpzend-framework2google-code

Zend Framework 2 - Integrate PHP Addendum Library


I try to use the addendum library with Zend Framework 2 but I failed.

I tried to add it as a module by copying the addedum il to my \module\util directory. It dosent work.

Then I try something else. I copied the directory under \vendor and addendum like that:

<?php

// autoload_namespaces.php generated by Composer

$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);

return array(
    'Zend\\' => $vendorDir . '/zendframework/zendframework/library/',
    'ZendTest\\' => $vendorDir . '/zendframework/zendframework/tests/',
    'Psr\\Log\\' => $vendorDir . '/psr/log/',
    'Monolog' => $vendorDir . '/monolog/monolog/src/',
    **'Addendum' => $vendorDir . '/addendum/',**
);

It dosen't work

So I tried to add it at the end od the init_autoloader.php like this:

$loader = new Zend\Loader\StandardAutoloader();
$loader->registerNamespace('Addendum', __DIR__ . '/vendor/addendum');
$loader->register();

When I try to instantiate a class like this:

$foo = new \ReflectionAnnotatedClass($obj);

I always have the same error:

PHP Fatal error:  Class 'ReflectionAnnotatedClass' not found in MyClass.php

Solution

  • use composer - and add there:

    "require": {
        "php": ">=5.3.3",
        "zendframework/zendframework": "2.*",
        "niktux/addendum": "dev-master"
    }
    

    then just php composer.phar install

    https://github.com/Niktux/addendum

    Then composer autoloader should sort it out for you.