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

时间:2016-09-15 07:45:44

标签: composer-php symfony

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

1 个答案:

答案 0 :(得分:20)

您只需运行composer run-script post-install-cmd

即可

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

如果您想构建参数,请在您的composer / scripts部分中创建一个新部分。像这样:

"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"
    ]
},
...

然后运行composer run-script build-params