Sublime Forum

Need help to develop plugin

#1

Hello,

I need to run php script on dos directly through sublime editor.

i.e. Tools > packages > Run PHP Script

Whenever I invoke “Run PHP Script”, I need dos to run “php.exe filename.php” in current file’s directory.

Could you help me to do so? will save my lots of time.

PS: I am using Windows 7 and have licensed copy of “Sublime Text”

Regards,
Vikas

0 Likes

#2

You can use the build system functionality for this.

Use “Tools/New Build System” to create a new one, then set the build line to:

build php.exe $File

(assuming that php.exe is in the PATH), and workingDir to $FilePath. Save it as PHP.sublime-build, and you should see it in the “Tools/Build Systems” menu.

There’s more documentation at sublimetext.com/docs/build

0 Likes

#3

Yes, It worked thanks for the support. :smile:

0 Likes

#4

Hello Admin,

It would be great, if you help for the same in Sublime X

# See http://www.sublimetext.com/docs/build for details
build make
lineNumberRegex ^(...*?):([0-9]*):?([0-9]*)
showWhenFinished true
workingDir $ProjectDir
build php.exe $File

Raise the error attached in screenshot.

Please Guide.

0 Likes

#5

The syntax of the .sublime-build files has changed in Sublime Text X, they’re now JSON based - have a look at some of the others, such as Python/Python.sublime-build.

0 Likes

#6

Thank you for pointing that out.

following code worked for me to add PHP build menu.

{ "cmd": "php", "$file"], "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.php" }

0 Likes