How do I run a Symfony Console command after composer install?

后端 未结 1 1144
南笙
南笙 2021-02-12 14:05

My composer.json contains the following declaration:

    \"post-install-cmd\": [
        \"Incenteev\\\\ParameterHandler\\\\ScriptHandler::buildPara         


        
1条回答
  •  既然无缘
    2021-02-12 14:29

    You can see how the postinstall hook work for the Sensio DistributionBundle.

    As example, this is how you can call the Hello World command of the Acme Demo bundle:

    ScriptHandler

    You can manage extra param in the json file itself.

    composer.json

    "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::removeSymfonyStandardFiles",
        "Acme\\DemoBundle\\Composer\\ScriptHandler::helloWorld"
    ],
    

    Tested

    I extend the ScriptHandler class of the sensio-distribution bundle of version:

    sensio/distribution-bundle (v3.0.18)
    

    hope this help

    0 讨论(0)
提交回复
热议问题