A php editor is a must-have tool for a php developer. Even if you are a beginner you need something more than a standard text editor when you write your php scripts.
A basic php editor offers many functionalities that help greatly and eliminate many distractions that make your creative efforts more difficult.
Let’s look at these basic functionalities.
Every language keyword is highlighted in a different colour. You will see that the keywords: if, switch, else, return, case, are rendered in a colour different from the ones used for other parts of your script.
You will know at first glance which keywords are standard parts of the php language and which ones are variables, strings or constants.
Just type the first letters of a keyword and you will be presented with a list of the keywords beginning with those letters. After you choose a keyword from this list, the editor will show information about that keyword. If the keyword you chose is the name of a function, the editor will show a description of the function and its parameters.
Just type “if” followed by the tab key, or other standard key, and you get the brackets automatically. Or just type “table” and you get the full structure of an html table.
Press a button and you will be guided through many dialogs that help you choose the parameters needed to write html, php or css constructs.
You want to modify a function but you can’t remember which file it is in. The symbol browser lists all your functions and takes you to where they are defined with just a click.
Search and replace in multiple files
What if you have to change a name or a symbol used in many files? It happens more often than you might imagine.
Just tell the editor what you want to change and it will make the change in all the open files or even in an entire directory.
Let’s look at a few php editors.
Free php editors, multi-platform
Let’s begin with free php editors, free as in free beer.
The following are also multi-platform. You can use them on Linux, Windows and Mac.
Geany is a light editor, it’s fast and it does everything we need.
It highlights syntax. It’s possible to customise the colours used to highlight.
It auto-completes syntax keywords and shows the parameters to be given to a function. It doesn’t show information about what a function is for.
Snippets are supported and customisable. There are no wizards to insert html or css. There is a symbol browser instead, and you get the powerful search-and-replace function extended to all open files.
I’m writing about Geany here, on the php editor’s page because it’s so light that you can use it as your everyday text editor. At the same time it has functionalities that qualify it as a PHP IDE.
With Geany you can check the syntax of your php scripts and you can debug them as well.
Bluefish has the wizards that Geany lacks. I recommend Bluefish if you do a lot of html or css writing. Geany is better if you do more pure php scripting.
Bluefish features syntax highlighting and you can customise the colours used to highlight more easily than in Geany.
Bluefish’s autocompletion is fully functional. It explains the function that you choose and its parameters. If you move your mouse over the name of a function, you get the description of it.
There is snippet support via a plugin and there are many wizards that help with writing html, css and php code.
There is no symbol browser. Unlike Geany, Bluefish is a pure editor and hasn’t any IDE functionalities.
jEdit is Java based. If you like the look and feel of Java applications, jEdit is for you.
Autocompletion in jEdit has to be activated pressing CTRL+b, which is not so convenient.
Syntax is highlighted and colours are highly customisable.
jEdit indents your code if it gets messed up. You have to configure this function a bit to make it work.
There are loads of plugins to implement a lot of functionalities. You can use snippets and even download them from a snippet repository.
What about a symbol browser? You have to use a plugin named CtagsInterface which is a bit buggy.
On the other hand, the search and replace function is great. It allows you to search and replace in all the open files and even in a directory.
There are no wizards.
Komodo Edit is multi-platform but not Java based. It’s based instead on the same code used by Firefox.
It has customisable colour schemes and very good auto completion function. Syntax highlighting is easy to customise.
You can jump to the definition of a function when you find it called in your script. There isn’t a symbol browser.
It’s possible to search and replace a string in the current file, in all open files and in a directory.
Komodo offers syntax check performed in real-time.
There are a lot of useful snippets. Komodo is not as light as Geany. Anyway, if you like it, you will find yourself at home if you choose Komodo IDE as your PHP IDE.
Free php editors, Linux only
Gphpedit is even lighter than Geany, but it lacks many useful aspects.
You will find that Gphpedit and Geany are similar because the code they are based on is the same.
Gphpedit’s search functionalities are very basic while auto-completion is good. It doesn’t add parentheses and braces if you begin an if statement.
If you have php installed, Gphpedit will check the syntax of your code.
The symbol browser is the same as Geany. Snippets are not provided.
Gphpedit could be a bit richer and focused on php support. It’s light, but Geany is light too and richer.
Free php editors, Windows only
Notepad++ lives in Windows only but it is based on the same Scintilla component used by Geany.
It offers customisable syntax highlighting. The customisation options will make the most exigent of developers happy.
Notepad++ offers auto completion function with word completion, function completion and function parameters hint.
The interface is very customisable. When you have many open files, it may be not enough to have them open in different tabs, you may want to arrange the tabs according to your preferences.
You can search and replace in open files and even in directories.
The symbol browser is called Function List. Snippets are managed through plugins.
Notepad++ is complete, only wizards are missing, but there are many other useful functionalities.
Dev-PHP comes in two versions, editor and IDE.
Here I’m going to review the editor version of Dev-PHP. It features configurable syntax highlighting.
Its auto completion function offers completion of function name and parameters hints. Wizards produce the code needed for loops or other constructs. Just fill in the variable parts. Code snippets are customisable.
There is a symbol browser that helps to find your functions quickly.
It’s possible to search in all the open files and in directories.
Dev-PHP is more than an editor, it has IDE functionalities and it’s quite complete.
Commercial php editors, Windows only
DzSoft PHP Editor
DzSoft PHP Editor is actually a full IDE. You can run and syntax-check your code.
As editor, it features a very good symbol browser similar to the one offered by Geany. It’s also possible to jump to a function’s definition from a line where it is called.
Syntax highlighting is present and customisable.
Auto-completion of function names and parameters hints are provided. However to complete a function’s name you have to press ctrl+enter and choose the function from a list. You can type quickly the first 3-4 letters of the function’s name and the editor will find the function. You don’t get a description of the function or its parameters.
There is the interesting possibility of choosing among many shortcut schemes. This is useful if you are accustomed to the shortcuts used in another editor.
You can quickly insert snippets of code: here they are called code templates.
It’s possible to search all files in a directory, but there is no replace. Search and replace are fully supported only for the current file.
Personally, I prefer to stick to multi platform php editors because you never know if you will have to work on a Windows machine. Naturally I use Linux and LAMP platforms, but it may happen that I need to work on Windows machines and I want to use the same editor I use on Linux.
I don’t like the look and feel of Java applications and I prefer not to pay if there isn’t a real need.
So, I would have to choose between Geany, Bluefish and Komodo Edit. The latter isn’t as light as Geany.
I would use Bluefish for html/css work and Geany for PHP. Geany is also IDE and it may offer enough functions to obviate the need to learn another IDE.
If you work a lot on Windows computers, you can consider the Windows-only PHP editors I have reviewed above.
I would choose Notepad++ if I want a pure php editor.
If you want a PHP IDE running under Windows only, use Dev-PHP Editor. DzSoft PHP Editor’s autocomplete function isn’t so good