Installing suggested composer packages ZF2 (Zend Framework 2)

spankmaster79 picture spankmaster79 · Sep 13, 2012 · Viewed 7.6k times · Source

when you use the zend skeleton to start your new project and composer to install packages it recommends this:

    "doctrine/common": "Doctrine\\Common >=2.1 for annotation features",

    "ext-intl": "ext/intl for i18n features",

    "pecl-weakref": "Implementation of weak references for Zend\\Stdlib\\CallbackHandler",

    "zendframework/zendpdf": "ZendPdf for creating PDF representations of barcodes",

    "zendframework/zendservice-recaptcha": "ZendService\\ReCaptcha for rendering ReCaptchas in Zend\\Captcha and/or Zend\\Form"

I could install the zendpdf, zendservice-recaptcha and doctine/common package but not the PECL ones.

I think it's a little sad that zf2 suggest the packages, but leaves users alone with, how to properly configure the composer.json.

I heard composer could also get PECL packages, but couldn't find any documentation on it.

How do I install them?

Answer

stormwild picture stormwild · Sep 28, 2012

To install the suggested packages, modify composer.json to include them.

"repositories": [
    {
        "type": "composer",
        "url": "http://packages.zendframework.com/"
    }
],
"require": {
    "php": ">=5.3.3",
    "zendframework/zendframework": "2.*",
    "doctrine/common": "dev-master",
    "zendframework/zendpdf": "2.*",
    "zendframework/zendservice-recaptcha": "2.*"
}

Then run

php composer.phar update

Note: that composer installs doctrine/common by using

git clone http://github.com/doctrine/common

On Windows git needs to be in your PATH environment variable.

Regarding ext/intl, this extension is bundled with PHP as of PHP version 5.3.0. and can be found in the ext/ folder of your php installation.[1]

To enable, uncomment (remove the semi-colon before the directive) it in php.ini

extension=php_intl.dll

Regarding pecl-weakref, this is also a PHP extension however this is not bundled with php and needs to be installed. More information on how to do that can be found at http://php.net/manual/en/install.pecl.php

A DLL for this PECL extension is currently unavailable. See also the building on Windows section. [4]

[1] http://php.net/manual/en/intl.requirements.php

[2] http://php.net/manual/en/weakref.installation.php

[3] http://php.net/manual/en/install.pecl.intro.php

[4] http://php.net/manual/en/install.pecl.windows.php