运行 composer update
后,我需要运行两个命令,一个是调用 .sh
文件的 Linux 控制台命令,第二个是 php 应用程序/控制台
命令。通过在 composer.json 文件中执行某些操作可以实现这一点吗?我注意到这一行:
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
]
但不知道这样是否正确。以第一个命令为例:/home/data.sh
和第二个命令php app/consoledoctrine:fixtures:load --append
,对此有什么建议吗?
最佳答案
您可以将这些命令包含在 post-update-cmd
指令中,如下所示:
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"/home/data.sh",
"php app/console doctrine:fixtures:load --append"
]
关于php - 在 Symfony2 项目中的 "post-update-cmd"上运行命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23171449/