可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
in my project i need to use two versions of twitter bootstrap (v2.x and v3.x) 2 for the backend and 3 for the frontend. is it somehow possible to require both and tell composer to install them in different directoreies?
something like that:
{ "name": "acme/hello-world", "require": { "twitter/bootstrap": "2.3.*", "twitter/bootstrap": "3.0.* as 'twitter/bootstrap3'" } }
回答1:
You can't require two version, your application should only use one version of a package.
回答2:
If you want you can overwrite the namespace inside loader object. Not exactly having two version at the same time. But maybe you want to use an other version somewhere in your scripts.
$reflection = new \ReflectionClass(\Composer\Autoload\ClassLoader::class); $vendorDir = dirname(dirname($reflection->getFileName())); $loader->set('Company\\Classname\\', $vendorDir.'/composer/../Other_company/OrOtherClassname/src');