假设我们有以下目录结构,我们假设my-package
Packagist上也存在:
- apps
\_ my-app
\_ composer.json
- packages
\_ my-package
\_ composer.json
要添加my/package
为my-app的依赖项,文档说明我们可以使用以下配置:
{ "repositories": [ { "type": "path", "url": "../../packages/my-package" } ], "require": { "my/package": "*" } }
但是当我 composer update
,依赖仍然从Packagist下载.所以,看,我禁用了Packagist.org:
{ "repositories": [ { "type": "path", "url": "../../packages/my-package", "packagist.org": false } ], "require": { "my/package": "*" } }
我与清除缓存composer clearcache
,删除my/package
具有composer remove my/package
与再次进行安装它composer require my/package --prefer-source
(如果我没有理解--prefer-source
仅用于VCS).下载的软件包仍然不是本地软件包.如何强迫作曲家使用本地作曲家?
"require": { "my/package": "*" }
对于VCS
或path
存储库类型,您需要指定所请求的包的版本.因此,不要*
像现在一样使用@dev
:
"require": { "my/package": "@dev" }