Since programmers spend a lot of time in their editors and IDEs, they are extremely serious about their choice of software. At a minimum, the programming environment should provide syntax checking and code correction, autocompletion and auto-addition – all known as "code intelligence." You should consider the whole aggregate of technologies used – HTML, CSS, JavaScript, PHP, as well as the distributed nature of any WEB-application.
PHP is a server programming language and, in most cases, scripts are written on one computer and run on the other, in the environment of the hosting operating system. The server part of any site may also include a huge number of SQL queries and intensive interactions with databases.
If you decide to go beyond hobby-level projects to program professionally, it is critical for your program to support the FTP protocol, understand the syntax of SQL, and provide an interface for connecting to databases, in addition to advanced editing capabilities.
Let's examine how popular code editors and IDEs implement such important capabilities for PHP developer functions.
Sublime Text
Sublime Text presents an excellent example of balance between functionality and speed, along with an economical use of system resources. The latest version works efficiently and quickly, and a reduced amount of RAM used too. It works on Windows, Linux, and Mac OS. Additionally, there is a portable version for Windows.There is a flexible system of settings for both the interface and all kinds of functions using configuration files in JSON-format. The editor provides a set of APIs, so it can be programmed and extended using Python. There is even a built-in Python interpreter.
Immediately after starting the program, go to the main menu Tools -> Install Package Control. Package Control is a tool that allows you to manage other packages.
To expand the functionality, you have to install the packages. Start the Package Control, go to the main menu Preferences -> Package Control and enter the command Install Package from the keyboard.
Working with the code
If you open the folder with code, the editor will consider it a project.To check the syntax of PHP when saving files, install the PHP Syntax Checker extension. Then if there are errors, a warning dialog will appear.
To highlight syntax errors on the fly, install the plug-ins SublimeLinter and SublimeLinter-php. For them to work properly, also install PHP 7.0.
Now the editor will check the file and highlight the problem line of code. You can also get information about the error in the tooltip and on the bottom panel of the editor
To get a list of links including the file with the function declaration and its use cases, simply hover the pointer on the function name.You can also instantly go to the function declaration or class definition by right clicking on it and selecting Go to Definition from the context menu.
For those who work with frameworks and OOP, there is PHPCompanion, a special plugin that immediately adds a whole set of useful tools to the program. This module helps to work with namespaces and import classes.
Debugging capability
Use the plugin Xdebug Client to perform full debugging with minimal settings. To work with this package, enable the Xdebug PHP extension on your server.SQL and databases
There are two extensions for this – SQLExec and SQLTools. They share similar functionality and settings. You can also connect to PostgreSQL, MySQL, Oracle, MSSQL, SQLite, Vertica, and Firebird. You must also install a binary distribution of DB, with which you plan to interact.Working on FTP
You’ll find it convenient to work with a remote file system using FTP, FTPS, and SFTP with the SFTP extension. It provides a very simple interface for viewing the folder structure and manipulating files.Viewing files structure on Sublime Text
Files are automatically uploaded to the server after saving, and there’s support for the output of information about the process of connection, downloaded, and uploaded files. All settings and actions within this plugin can be found in the menu File -> SFTP/FTP.Support for frameworks
There is only basic support for MVC frameworks, mainly represented by various snippet collections and quick access to online documentation.Atom
Atom is the editor the PHP community would like to know more about. Many developers who have experienced it were pleased with it – the editor is very flexibly configured, but the default settings also work well.Atom is an open source editor, created using WEB-technologies. Extensions for Atom are created using simple JavaScript and a Node.js framework.
It is a cross-platform with versions for Mac OS, Windows, and Linux. There is also a portable version for Windows systems.
The portable version allows you not only to use the program without installation, but also to use several versions of the editor for various programming tasks simultaneously.
Working with the code
Atom allows you to open both individual files and entire directories as a project. Initially, there is basic support for PHP syntax.This editor easily turns into a PHP IDE. To do this, install the Atom-ide-ui add-on and the specific plug-in IDE-PHP. In addition, PHP 7.0 runtime must be installed.
After applying these actions, Atom gets a more functional appearance
These add-ons provide error detection, warnings display, autocompletion and auto-addition, and improved code navigation.Debugging capability
You can add this with extensions. For example, support for Xdebug can be enabled by installing the modules PHP-debug and Atom-debug-ui.SQL and databases
The Data-Atom package is used to enable the support of MySQL, PostgreSQL and Microsoft SQL Server. It allows you to create connections, then view the structure of the database and tables, and perform any queries.SQL support in Atom
You will find settings and appropriate functions in the main menu Packages -> Data Atom. To properly install this plugin, Git should also be installed.Working on FTP
An ability to connect to a remote computer without extraneous FTP clients is achieved with the FTP-Remote-Edit package.First, create a connection. Then you can view the contents of the remote directory, and the files will be automatically uploaded to the server after saving.
Support for frameworks
As you know, editors are not the best choice when you need to work with a lot of frameworks. However, their support can be configured by installing one or more additional packages.Virtually, editor has extensions for various PHP frameworks, but for this software, JavaScript libraries support is better implemented.
Rapid PHP
Rapid PHP is a PHP editor with a good reputation and advanced functionality, so you could call it a lightweight IDE.It includes the entire set of components for writing scripts in PHP and JavaScript as well as for using HTML and CSS.
There are several useful features to make it easier for novice programmers to start coding, for example, the familiar user interface, the lack of unnecessary controls and the built-in PHP interpreter.
Immediately after launching the program, you are offered a minimal user interface. Then, during the operation, you can hide and show all open panels by pressing the F4 key. There’s also an upgraded editor with PHP syntax checking, fragments insertion, highlighting search entries, and high performance when opening large files.
There is a convenient function, Goto Anything, that allows you to quickly start a search by pressing the Ctrl + G keys to go to any section of the code or file in the project.
Many useful features can be added to the editor by installing additional plug-ins. To see a list of available extensions, select the Plugins -> Manage Plugins option from the main menu.
Working with the code
Rapid PHP has advanced features for editing PHP files, including integrated documentation and tooltips on functions.For example, to get a hint on the parameters of a function, just enter its name and press Ctrl + Shift + Space
Debugging capability
The PHP debugger works in conjunction with Xdebug and provides all the standard functions for finding errors in scripts. You can track the state of the user-defined and global variables, view call stack, execute the file step by step or by using checkpoints.SQL and databases
Rapid PHP has a built-in SQL Database Explorer with an ability to connect to MySQL, PostgreSQL, Firebird and SQLite. It allows you to execute queries and view the structure of the database.Working on FTP
A convenient file browser and the built-in FTP client allow you to work with remote files using both simple FTP and secure connection using TLS, SSL and SSH.Support for frameworks
Smarty is supported by default. To work with the syntax of other libraries, go to the main menu Options -> Frameworks.The following components are available: CakePHP, CodeIgniter, Laravel, Nette, Prado, Symfony, Yii and Zend Framework. From content management systems only, WordPress is supported
CodeLobster
CodeLobster is created by our team and it’s a well-known IDE with support for all WEB-technologies. It’s written in C++. And consequently it has a responsive interface and notable fast editing – there are no delays while typing code.Here, you will find all the tools that PHP programmers might need. Project work is provided by a simple navigation through code and files, understanding of the structure of the project, instant search, and identification of syntactic errors.
Working with the code
It’s a multilingual editor that understands files with mixed code and provides appropriate highlighting in different colors. When working with large sources, use local bookmarks and the ability to collapse blocks of code.Most actions in CodeLobster are duplicated by keyboard shortcuts. For example, press Alt + C and you can instantly comment on the current line or selection. Then press Alt + Ctrl + U to uncomment the fragment. There’s an integrated help system – you can see tooltips when hovering over an item of interest, an autocomplete for all PHP functions, and additional libraries.
Dynamic help works depending on the context. The IDE automatically selects a list of links to relevant documentation for the current element in the code. To use this function, go to the Dynamic Help tab on the right panel of the editor
To view online help on the element on which the cursor is positioned, press the F1 key to open the official documentation in the browser.Debugging capability
The Xdebug extension is used during the search and elimination of errors in PHP scripts. However, you should first enable and configure it on the server.SQL and databases
The system of interaction with databases contains a built-in SQL-client; you can create several connections and link them to projects in the settings. Syntax highlighting, autocompletion, and auto-substitution are implemented according to the structure of the current database. Created queries are saved in files with the sql extension, so that you can later edit them and view the results.Working on FTP
CodeLobster is enabled with an FTP connection manager, which can be flexibly configured for any type of server and copes well with downloading and uploading a large number of files. The files are transmitted in binary or ASCII modes; you can work with the server over an encrypted connection using SSL/TLS or SSH.Support for frameworks
CodeLobster comes with a whole set of plug-ins for working with the most popular PHP libraries and CMS, among them such frameworks as CakePHP, CodeIgniter, Laravel, Phalcon, Smarty, Symfony, Twig, Yii.You can download, install, and add to the project any of the listed frameworks directly from the program environment.
You can start creating your online store on the basis of Magento, the famous eCommerce platform – just select the type of project you need and configure access to the database
The latest version of the CMS will be downloaded and installed in automatic mode, without even using the Web-interface.The same functionality is provided for Drupal, Joomla, and WordPress. Using all the capabilities of these systems will greatly accelerate the process of developing and launching Internet projects of any scale.
PHPStorm
PHPStorm is a popular IDE with a huge number of different functions and features. It performs an in-depth analysis of the project and understands its structure and dependencies very well.It’s developed in Java programming language based on IntelliJ IDEA – an open source platform, meaning that PHPStorm inherited all the best from its parent platform.
Every detail can be customized. There are numerous hot keys, various highlight styles, and themes for the user interface.
Working with the code
If the folder in which you placed a new project already contains files, the project will be created based on the existing sources.To use auto-completion, start typing the name of the method or class and press Ctrl + Space – all available options will appear as a list. After that you can get a hint about the parameters To do that, press Ctrl + Shift + Space.
For instant reference information on any function, just place the cursor on its name and press Ctrl + Q.
Click on the link in the window that appears to go to documentation on the official website for more detailed analysis
Debugging capability
There is a full Visual Debugger that’s recommended for use in conjunction with the Xdebug extension, but integration with Zend Debugger is also possible.SQL and databases
To display SQL-tools and view the list of connections, select View -> Tool Windows -> Database from the main menu. You can connect to many different databases: DB2, Derby, HSQLDB, MySQL, Oracle, PostgreSQL, Microsoft SQL Server, SQLite, and Sybase.After all the necessary settings are made, the connection is established and these options become available: overview of the database structure, editing of tables, deletion and addition of fields and new records, execution of various SQL queries, and many others.
Working on FTP
Download and upload files via FTP using any type of connection – FTP, SFTP, or FTPS. To use this function, go to the main menu File -> New Project from Existing Files and select the option Web server is on remote host files are accessible via FTP/SFTP/FTPS.Next, name the project, set up an FTP connection, and download remote files for editing.
Support for frameworks
Template engines Blade and Smarty, MVC frameworks in particular such as Laravel, CakePHP, Symfony, Zend Framework, Yii are supported.The ability to create projects based on content management systems, such as Drupal, Joomla, and WordPress, are well implemented. The IDE supports WordPress Actions and Filters. It offers an autocomplete and dynamic hints on existing parameters.
The IDE is able to index the code of any PHP library and then use this data to display documentation or function hints
Let's summarize
Much work was done by the developers when creating the tools discussed in this article.As a rule, IDEs come with a lot of functionality that can’t just be selected and disabled. But it is thanks to such advanced functions that PHP programmers can get the most out of a programming environment while creating their applications and websites.
But why should an IDE lose performance with expanding functionality? At what stage of its life cycle may the development environment become "slow-moving" and inconvenience its users?
We, the CodeLobster team, tried to find an effective solution to this problem. So, we chose the low-level C++ language and the Qt library to preserve all the advantages of the native application.
As a result, the program is experiencing robust growth and we constantly add support for the new and most up-to-date WEB-frameworks. Despite the complexity of this approach and all the difficulties in maintenance of low-level code, the user experience has been greatly improved.
Because a completely cross-platform version has recently been released, you can now independently test this application on any OS.
But any editor is still a construction set. After installation, we get only the most necessary, universal capabilities. It will be necessary to install additional extensions to turn any of the editors into a full-featured IDE. But they start almost instantly, work quickly, and are not demanding on computer resources.
Which program is the best? Everyone should decide that for themselves individually.
To use a simple and fast editor or to take a full-fledged IDE – that depends on the developer her/himself, on what solutions they are seeking at the moment, and under what conditions they’re working.
Stanislav is a project manager in Codelobster Software with 10-year experience in PHP coding.
Want to write an article for our blog? Read our requirements and guidelines to become a contributor.