Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Symfony's console script name

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.

like image 223
emix Avatar asked Jan 02 '23 09:01

emix


1 Answers

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"
    }
}
like image 140
Nek Avatar answered Jan 05 '23 11:01

Nek