Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend Framework Composer Packages

I would like to add dependency to zendframework/zend-db package, so I added it to my composer.json:

"repositories": [
    {
        "type": "composer",
        "url": "http://packages.zendframework.com/"
    }
],
"require": {
    "php": ">=5.3.2",

    "symfony/class-loader":  "dev-master",
    "symfony/console":       "dev-master",
    "symfony/filesystem":    "dev-master",
    "symfony/finder":        "dev-master",
    "symfony/locale":        "dev-master",
    "symfony/yaml":          "dev-master",
    "doctrine/dbal":         "dev-master",
    "zendframework/zend-db": "dev-master"
}

The problem is that composer installs entire zendframework/zendframework package.

Any idea why?

like image 519
umpirsky Avatar asked Jul 31 '12 19:07

umpirsky


2 Answers

as explained here http://packages.zendframework.com/#composer ZF2 now provide a composer repository with all modules.

to add the repo to you package:

"repositories": [
    {
        "type": "composer",
        "url": "http://packages.zendframework.com/"
    }
],

and from here on you can add packages seperately:

"require": {
    "zendframework/zend-config": "2.0.*",
    "zendframework/zend-http": "2.0.*"
},

you only need to specify the packages you want, if they have dependencies they will be resolved by compser.

allthough this does not seem to work atm...

like image 114
NDM Avatar answered Nov 20 '22 16:11

NDM


Here's the composer.json from zend-db in the zend github. According to the file, zend-db does not have any dependencies.

This can be due to the fact that you're trying to download a package from dev-master and there's a missmatch in the composer.json of the dev-master.

I would suggest you to change the required version to something like 2.0.* and try again.


Also, Although Zend Framework is loosely coupled, in the older versions of the framework the dependencies were not explicit.

For instance, with a quick sweep over the source code of zend_db from ZEND 1.9, I found that it depends, at least, on the following packages:

  • Controller
  • Config
  • Filter
  • Json
  • Loader (for autoloading, I reckon this might not be necessary due to composer autoloader)
  • Uri
  • View
  • Wildfire

These packages might have other dependencies, hence the download size. Regardless, as King explained, Zend Framework 2.0 is different from version 1.9 and maybe this is not applicable to 2.0

like image 32
Tivie Avatar answered Nov 20 '22 15:11

Tivie