Search code examples
phpxmlphpstormlaravel-artisanlaravel-5

Cannot make command line tool for artisan in PHPStorm 10.0.1


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!


Solution

  • 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.