Saturday, 15 May 2010

php - Composer: two vendor directories (one of them is symlinked) - shared library autoloading -



php - Composer: two vendor directories (one of them is symlinked) - shared library autoloading -

i need 2 vendor directories autoloaded within symfony 2 application. first explain why need this, create more clear:

i have many little projects/websites written in symfony 2 symlinks shared library provides domain models etc.

one of projects app structure:

|- app |- library -> ../library (symlink) |- src |- vendor |- web

the library project has many , of import vendors (doctrine etc.), cannot install vendors of library within every's project vendors directory. take alot of disk space.

do need merge 2 vendors ([root]/vendors , [root]/library/vendors) autoloaded not copied? if this, composer.lock fail guess, because vendors live in different directories.

how done composer? tips, out of ideas.

thanks!

the symfony 2 app/autoload.php file can used add together additional directories load from.

/** * @var $loader classloader */ // composer generated autoloader $loader = require __dir__.'/../vendor/autoload.php'; // additional directory load $loader->add('cerad', __dir__ . '/../../cerad2/src'); // majic annotationregistry::registerloader(array($loader, 'loadclass')); homecoming $loader;

php symfony2 composer-php autoloader

No comments:

Post a Comment