php - Loading multiple versions of the same library -


i'm using library, zend framework in , has path

zendframework-1.10.8/library/zend/

i load in index.php

realpath(central_libs_path . '/zendframework-1.10.8/library'), // /zend left out

and can call 1 of classes class zend_form_

now question, how can use multiple versions of same library. suppose load both of in index.php

realpath(central_libs_path . '/zendframework-1.10.8/library'), realpath(central_libs_path . '/zendframework-2.0.0/library') 

but when call class zend_form, how explicitly tell use 1 v1.10.8 or 1 v2.0.0? remember reading somewhere if 2 libraries have same class, library above 1 called. how can switch between 2 @ will? can done in same project?

zend framework 2 classes grouped within namespaces , has own autoloader looks through directories (it should 1:1 relationship between directory , namespace).

you need register both autoloaders (you may need rewrite zf 1.10 use spl autoloading can register multiple autoloaders. @ point autoloaders should handle themselves, since there distinct difference in how zf1 try load zend_form , zf2 try load zend\form. go ahead , modify zf1 autoloader ignore request using true php namespaces.

don't forget, spl autoloading uses fifo method of looking classes if you're intending use zf2 classes should register autoloader first , zf1 second, give decent performance boost.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -