Is there a PHP syntax checker for Notepad++?

53,593

Solution 1

Try NppExec plugin for Notepad++. Using it create a command to be something like this:

cmd.exe /K c:\your\path\to\php.exe -l "YOUR_FULL_FILE_NAME"

Instead of YOUR_FULL_FILE_NAME you should use appropriate Notepadd++ macro -- I think it is $(FULL_CURRENT_PATH) but double check with NppExec manual (installs together with plugin).

P.S. But any IDE will be better for sure (I'm using PhpStorm). If IDE is too heavy for your PC then look for php-oriented editors, like Blumentals RapidPHP etc (it's lighter than full IDE but may have all really important features).

Solution 2

As LazyOne said above, you can use NppExec which you can install using the plugin manager (Plugins>Plugin Manager>Show Plugin Manager) You'll also need to have PHP installed. Lastly, the command I use to do PHP syntax checking with NppExec is

"C:\Program Files (x86)\PHP\php.exe" -l $(FULL_CURRENT_PATH)

Solution 3

I recommend you find a true IDE (not a glorified text editor). I've used Notepad++ for years but it can't do much beyond syntax highlighting.

I personally use PHPStorm (but it's not free, it is very good though :D ). You could also use NetBeans or Eclipse.

Solution 4

Adding to @LazyOne's answer: I don't like NetBeans, it's too strict, has a tough time finding includes, and it's slow. I dig N++ for its speed and simplicity. I have php installed on my PC really just to run validation. If you're using N++ (or any other text editor) you can use the following Powershell script to batch check all of the files you've downloaded and are working on. Just fire up Powershell ISE, enter the correct path to check and PHP.exe path for your environment and the results get output to the ISE console.

cls
$pathToCheck = "C:\Users\BigDaddy\AppData\Local\Temp\fz3temp-1"
$phpExePath = "C:\PHP\php.exe"

Get-ChildItem $pathToCheck -Filter "*.php" | foreach {
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = $phpExePath
$pinfo.Arguments = "-l", $_.FullName
$pinfo.RedirectStandardError = $true
$pinfo.RedirectStandardOutput = $true
$pinfo.UseShellExecute = $false
$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | Out-Null
$p.WaitForExit()
$output = $p.StandardOutput.ReadToEnd()
$output += $p.StandardError.ReadToEnd()
$output
}

I hope someone else finds this as useful as I have.

Cheers!

Solution 5

I use Komodo Edit 7 (free version) which has a built-in php syntax checker. I dunno how robust it is, but it works fine for me. I’m not a pro web designer, but I like it better then Eclipse and Bluefish. Komodo is smaller than Eclipse and more stable than Bluefish (in my Win XP environment).

Share:
53,593
edt
Author by

edt

Updated on October 22, 2021

Comments

  • edt
    edt over 2 years

    Is there a PHP syntax checker plugin for Notepad++?

    Please don't answer "Use another editor instead"

  • edt
    edt almost 13 years
    I also use NetBeans and Eclipse. But, my computer is too slow. So, Notepad++ is the winner. Real solution is to get a better computer.
  • Halcyon
    Halcyon almost 13 years
    PHPStorm is very fast. A lot faster than Eclipse or NetBeans, which is why I use it. Sure you incur some loss when opening a project but if you learn the hotkeys it's sooo fast. I totally love ctrl+shift+n and ctrl+shift+f is actually super fast.
  • Cyclone
    Cyclone almost 13 years
    What about a non-commercial IDE?
  • Halcyon
    Halcyon almost 13 years
    A good non-commercial IDE? That's an oxymoron don't you think? ;)
  • Mr_Chimp
    Mr_Chimp over 12 years
    You can do this in the Run menu, you don't need NPPExec installed.
  • Ravikant Upadhyay
    Ravikant Upadhyay almost 11 years
    notepad ++ is the best and the fastest editor for advanced users.you can also try php designer it is also good. i dont like other editors.
  • h0mayun
    h0mayun about 9 years
    I tried php storm, net beans, zend studio... but i love notepad++ more than anything . because of its speed and lightness. i hope i find a good and light ide ...
  • Dave S
    Dave S about 7 years
    Like Mr_Chimp said, you can use Notepad++'s run command. Here is the exact syntax I used after downloading the Windows PHP binaries from php.net and copying them into e:\depot-tools: cmd.exe /K "E:\depot_tools\php-5.4.45\php.exe -l $(FULL_CURRENT_PATH)"
  • jmp
    jmp almost 5 years
    cmd.exe /K C:\xampp\php\php.exe -l "$(FULL_CURRENT_PATH)" && exit