Cannot make command line tool for artisan in PHPStorm 10.0.1

浪尽此生 提交于 2019-12-06 11:20:15

问题


I got this error message when I tried to make an alias for artisan: [Settings | Tools | Command Line Tool Support ] -> add -> tool based on Symfony Console

Problem

Failed to parse output as xml: Error on line 4: Content is not allowed in prolog..

Command

C:\xampp\php\php.exe C:\xampp\htdocs\laratest\artisan list --xml

Output

[Symfony\Component\Console\Exception\RuntimeException]
The "--xml" option does not exist.

Ok, I know, what's the problem but I don't find any solution for this. Thank you for the tips!


回答1:


A temporal modification of the "artisan" file under the Laravel folder will do the trick. (Working on PhpStorm 10.0.3)

if( isset($argv[1]) && $argv[1] == 'list' && 
    isset($argv[2]) && $argv[2] == '--xml' ) {
    $argv[2] = '--format=xml';
    $_SERVER['argv'] = $argv;
}
require __DIR__.'/bootstrap/autoload.php';

Now you can add the "artisan" command line tool support based on Symfony and remove the lines if you wish to.




回答2:


For everybody affected, this is the commit which removed support for –xml: https://github.com/symfony/console/commit/6d6d9031b9148fed0e2aacb98ac23ce6168ba7ac

Just revert changes in ListCommand.php

it work in 2.7 version




回答3:


There is no --xml option, you are getting this error when you running this command:

The "--xml" option does not exist.

So what you should do in this case is running:

php artisan help list

and you will get list of all available parameters

and now you will know you need to use:

php artisan list --format=xml

instead of:

php artisan list --xml

EDIT

I've verified it in PhpStorm 10.0.3

as Tool path you can paste in your case:

C:\xampp\php\php.exe C:\xampp\htdocs\laratest\artisan list --format=xml

and it will work




回答4:


Update composer before add command line tool:

composer update


来源:https://stackoverflow.com/questions/34422376/cannot-make-command-line-tool-for-artisan-in-phpstorm-10-0-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!