[L5.1] Artisan Not working in Command Line Tool - PhpStorm Hi
I'm trying to integrate Artisan in the command line tool in PHPStorm, so I can use aliases in my windows enviroment following these instructions:
https://confluence.jetbrains.com/display/PhpStorm/Laravel+Development+using+PhpStorm#LaravelDevelopmentusingPhpStorm-CommandLineToolSupportforArtisanandComposer
It was working with Laravel 5, but I can't make it work with L5.1 It seems phpstorm is calling artisan with the --xml param, instead of --format. Does anybody know how to solve this issue from phpstorm side?
Thanks
Problem
Failed to parse output as xml: Error on line 4: Content is not allowed in prolog..
Command
D:\Programas\xampp\php\php.exe D:\Programas\xampp\htdocs\backendDev\admin\artisan list --xml
Output
[ErrorException]
The --xml option was deprecated in version 2.7 and will be removed in versi
on 3.0. Use the --format option instead.
Sorry for answering a bit late, but you can place this code:
//Start - Code to allow PhpStorm CLI
if (isset($argv[1], $argv[2]) &&
$argv[1] === 'list' &&
$argv[2] === '--xml'
) {
$argv[2] = '--format=xml';
$_SERVER['argv'] = $argv;
}
//End - Code to allow PhpStorm CLI
before this line
require __DIR__ . '/bootstrap/autoload.php';
in artisan file (in your root directory)
Tested in LARAVEL 5.27 and PHPSTORM 10.0.7
Thank you for the tip. It was very useful.
if (isset($argv[1], $argv[2]) &&
$argv[1] === 'list' &&
$argv[2] === '--xml'
) {
$argv[2] = '--format=xml';
$_SERVER['argv'] = $argv;
}
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
Php Storm 10.0.3 and Laravel 5.2.12 not work
your code not working with Php Storm 10.0.3 and Laravel 5.2.12 not work
copy artisan to artisan-shim
add the following lines to artisan-shim just after the opening <?php tag
if(count($argv) == 2 && $argv[1] == "-V"){
echo "Symfony version 3.0.0";
} else {
if($argv[1] == "list" && $argv[2] == "--xml"){
$argv[2] = '--format=xml';
$_SERVER['argv'] = $argv;
}
}
Then
Open /vendor/laravel/framework/src/Illuminate/Console/Application.php
In __construct() replace
parent::__construct('Laravel Framework', $version);
parent::__construct('Symfony', '3.0.1');
and finish. Php Storm and Laravel 5.2 ready :)
Hi, here is a working solution: (in artisan.php)
Before
require __DIR__ . '/bootstrap/autoload.php';
add these
//STARTS - Code to allow PhpStorm CLI in PhpStorm 10.0.x and Laravel 5.2.x
if (isset($argv[1], $argv[2]) &&
$argv[1] === 'list' &&
$argv[2] === '--xml'
) {
$argv[2] = '--format=xml';
$_SERVER['argv'] = $argv;
}
if (isset($argv[1]) && $argv[1] === '-V') {
die('Symfony version 3.0.0');
}
//ENDS - Code to allow PhpStorm CLI
Please sign in or create an account to participate in this conversation.