为 Google APP Engine 更新 composer.json

Update composer.json for Google APP Engine

环境:php7.3

我在本地添加了一个新包composer.json

如何移动更改? gcloud app deploy 似乎忽略了它,因为那里没有出现新文件。

还有什么需要 运行 来检查新的 composer.json 并实时更新吗?

来自 GCP documentation

Composer runs automatically when you deploy a new version of your application. Simply add the following line to the top of your PHP scripts to require the autoload.php file:

require_once __DIR__ . '/vendor/autoload.php';

此外,

Scripts defined in your composer.json file will not run when Composer can use a cached result.

By default, App Engine caches fetched dependencies to reduce build times. To install an uncached version of the dependency, use the command:

gcloud beta app deploy --no-cache

如果有帮助请告诉我!

我遇到了这个问题,最终意识到我必须 运行:

composer install

宁运行之前

gcloud app deploy

我把这个答案放在这里以防它对其他人有帮助...