Add "Run Configurarion" option to get script from composer

My composer.json has the section:

"scripts": {
"test": "./vendor/bin/phpunit",
"migrate": "Builder\\Scripts::migrate",
"build": "Builder\\Scripts::build",
"restdocs": "Builder\\Scripts::genRestDocs",
"post-create-project-cmd": "Builder\\PostCreateScript::run"
},

And I would like to create a "Run Configuration" based on this the same way I do with "NPM". PHPStorm can read the "package.json" and create run configuration based on the scripts there. 

Is is possible? If dont how can I add as feature request?

Notice: 

I am currently using the "PHP Script" Run Configuration but it is not cross platform. So I cannot share with other people in different platforms.

1
9 comments

Hi there,

There is no such built-in functionality.

>I am currently using the "PHP Script" Run Configuration but it is not cross platform. So I cannot share with other people in different platforms.

What exactly is not cross-platform? Would be good to see how you are doing it right now.

0

I commit the configuration with my project by clicking on button "Share". 

The problem is because I have to fill the full location of the composer in order to get my script running even I already setup the composer on the PHPStorm. 

I take a screenshot to make my self clear. 

0

I see.

Have you considered using External Tools for this (to call it)? It's not shareable though.

Or maybe just do it as npm/grunt/gulp task -- IDE supports them as Run Configurations.

 

As for the "PHP Script" Run Configuration -- it can be by-passed by using Path Variables (and most likely will also require some symlink on Linux/Mac if you have Windows users as well) but requires some pre-configuration at IDE level (such path variable must exist on all IDEs where this project will be opened). It allows to use the same config by storing the path as "$SOME_VAR/composer" where $SOME_VAR$ transparently to the user can point to different locations on each computer.

 

As for the actual Composer Scripts support -- feel free to submit Feature Request ticket to the Issue Tracker

0

I know there are support for NPM/Gulp/Grunt. In fact this is a very nice feature. 

Unfortunatelly I have to use the composer because the components there are "pure" PHP. 

But I'll open a Feature Request.

Thank you!

0

>I know there are support for NPM/Gulp/Grunt. In fact this is a very nice feature. 

>Unfortunatelly I have to use the composer because the components there are "pure" PHP. 

I was talking about using npm/gulp/grunt to call your composer script -- not about replacing it.

0

I opened the issue WI-39028

Thank you.

0

Ah, I see:

In my "package.json"

"scripts": {
"build": "composer build",
"migrate": "composer migrate -- up"
},

That could be an option but it requires the node and the npm installed. 

 

 

 

0

That's just an option, of course.

But considering that pre- or post- processors for CSS are used for almost every project (e.g. Sass/SCSS/Less/PostCSS) and they all run (or can be run) using node ... it's pretty common to have it installed on a web dev machine (unless person does PHP only and does not touch front-end at all).

Surely, using some task manager to run another task just to make it convenient in IDE is a bit overkill (to say the least -- it's simply looks weird) ... but that's what everyone have to choose himself. Considering how easy it's to install and use nodejs (at least here on Windows) it should not be a huge issue.

0

Please sign in to leave a comment.