假如在云服務器上,項目根目錄在 /data/shop,則
示例:
cd /data/shop
響應的結果可能會有兩種:
1、第一種是直接require成功
示例:
composer require haveyb/tiny-laravel
#響應結果
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals- Installing haveyb/tiny-laravel (v1.0.0): Loading from cache
Writing lock file
Generating autoload files
?2、報錯 Could not find a version of package
出現這個問題的原因是包的作者并沒有打tag,這時我們可以執行命令:
composer require phalapi/qrcode @dev
也就是在后面添加一個 @dev,這時你會發現require成功,不再報錯了。
?注意:
如果作者沒有打tag,很有可能是包還沒有完善穩定,就不太建議繼續使用了,建議找其他的功能相似的包。
原文地址:https://www.haveyb.com/article/162