How to change Symfony's console script name
Asked Answered
G

1

6

I just installed fresh copy of stable Symfony 4 as follows:

composer create-project symfony/website-skeleton .

I would like to rename the console script name though from bin/console to bin/symfony. How to do that? If I just rename it, after composer install I get an error:

Script cache:clear returned with error code 1

!! Could not open input file: bin/console

Obviously this comes from the post install script:

"scripts": {
    "auto-scripts": {
        "cache:clear": "symfony-cmd",
        "assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
    },
    "post-install-cmd": [
        "@auto-scripts"
    ],

How to make this work properly? I already checked how to override Symfony's default structure, but found nothing related.

Garik answered 16/5, 2018 at 11:1 Comment(0)
T
10

Your error is related to Symfony Flex. If you specify "symfony-cmd" it will look for "bin/console". But it is just a shortcut and you can change it to the following:

"scripts": {
    "auto-scripts": {
        "bin/symfony cache:clear": "script",
        "bin/symfony assets:install --symlink --relative %PUBLIC_DIR%": "script"
    }
}
Thrasher answered 16/5, 2018 at 12:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.