如何在没有composer install/update的情况下为parameters.yml.dist生成parameters.yml

use*_*773 8 symfony composer-php

我有个问题.我想知道是否有任何替代方法来生成parameters.yml到parameters.yml.dist没有composer install/update.在作曲家安装/更新期间,分别生成和覆盖文件.但我希望不经过作曲家.我想知道是否有任何symfony控制台命令来实现这一目标.有人回答了吗?

Dmi*_*nko 21

你可以跑 composer run-script post-install-cmd

它可能会运行一些其他脚本(在默认的symfony配置中运行缓存,引导程序等).

如果你想建parameteres,使你的作曲家/脚本部分的章节.像这样:

"scripts": {
    "post-install-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
    ],
    "post-update-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
    ],
    "build-params": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
    ]
},
...
Run Code Online (Sandbox Code Playgroud)

然后跑 composer run-script build-params