是否可以通过作曲家更改PHP垃圾箱/控制台



我尝试添加

"scripts": {
    "sym": "php bin/console", 
    }

在Composer.json中,然后制作了composer install

但是,如果我运行sym make:migration而不是php bin/console make:migration,则有一个错误:

Command 'sym' not found, did you mean:
  command 'sem' from deb parallel
  command 'sm' from deb sm
  command 'vym' from deb vym
  command 'sys' from deb openafs-client
  command 'sum' from deb coreutils
  command 'syf' from deb alliance
  command 'spm' from deb salt-common
  command 'srm' from deb secure-delete
  command 'scm' from deb scm
Try: sudo apt install <deb name>

我做错了什么?

您必须以 composer的命令前缀。因此,composer sym make:migration将与作曲家一起完成工作。

要使您的命令工作不需要作曲家。您必须创建一个可执行文件。在您的项目root中创建一个名为sym的文件:

#!/bin/sh
php bin/console $1

使文件可执行chmod +x sym

./sym make:migration将工作。

相关内容

最新更新