Question

In our Zend Studio 10 setup for a ZF2 project we have the Zend Framework 2 included as part of our PHP Include Path. But then the project is also setup with vendor/zendframework/zendframework/library/Zend/ which contains a duplicate of the library in the include path.

Every time the auto complete comes up there is two of everything. And in fact when I remove the Zend library from the folder everything continues working.

Keep in mind this is the default setup when creating a new project with the project wizard.

Is there any reason to keep the vendor/zendframework/zendframework/library/Zend/ folder?

Update: It looks like the PHP Unit configurations look for the library folder directly and not the include path entries.

From TestConfiguration.php.dist

define('ZF2_PATH', realpath(__DIR__ . '/../../../vendor/zendframework/zendframework/library/'));

Was it helpful?

Solution

If autoloading happens through Composer, then consider that Composer actually downloads one copy of all dependencies per project.

This has been discussed over and over, but basically, the reason for it is that every project is "locked" to a specific set of dependencies with specific versions (dependency name + version = package).

In a zf2 project, you should not have a shared library anymore.

If your autoloading happens via composer, then you must keep that directory in vendor/, otherwise you will have to manually customize your autoloader in your init_autoloader.php.

Consider removing the shared library from Zend Studio instead.

Also, by default, ZF2 does not look for dependencies in the include_path, since a lot of performance is lost in stat calls when doing so.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top