A code editor is a software application developers use to write and edit computer code. It provides features like syntax highlighting, autocompletion, and error checking to help make the code-writing process easier and more efficient.
Generally speaking, code editors can be categorized as IDEs or lightweight editors.
An IDE, or Integrated Development Environment, is a software application that provides a complete environment for software development, allowing developers to write, edit, and test code all in one place. It typically includes features like a code editor, debugging tools, and a user interface for managing code projects, making the software development process more efficient and streamlined.
An IDE can be used for a variety of programming languages and is a helpful tool for both beginners and experienced developers.
There are dozens of options available for writing PHP code. The two most popular options are the following:
Visual Studio vs. Visual Studio Code
Visual Studio and Visual Studio Code are both software development tools created by Microsoft, but they are designed for different purposes and audiences. Visual Studio is aimed at the .NET platform. On the other hand, Visual Studio Code supports a wide variety of languages, including PHP. They're not to be confused with each other.
An IDE is designed to be a one-stop shop for all software development needs, making it easier for developers to manage larger projects. On the other hand, a lightweight editor is a simpler code editor that is optimized for speed and efficiency, focusing on providing just the core features necessary for writing and editing code.
Lightweight editors typically have a smaller footprint and use fewer system resources, making them a good choice for developers who prefer a faster, more streamlined experience.
The main advantage of a lightweight editor over an IDE is its speed and efficiency. Because lightweight editors are designed to be lightweight and fast, they are a good choice for developers who want a simple and efficient tool for writing and editing code.
Of course, the best lightweight editors are considered to be extensible. So, if you really want a feature that would typically find in an IDE, chances are there's an extension to add that one feature you need without bloating your editor.
Popular lightweight editors include:
- Sublime Text (cross-platform, shareware).
- Notepad++ (Windows only, free).
- Vim (cross-platform, free)
- Emacs (cross-platform, free)
It all boils down to preference
Opinions on which code editor to use are a dime a dozen in the programming world. Honestly, you can't go wrong with most choices. Play around with multiple editors and see what sticks with you.
It's not uncommon for developers on the same team to use different editors. Unless your company has a strict policy on what editor you should use, choose whichever you prefer.
For this book, the author prefers to use Visual Studio Code.
In addition, I also have the PHP Intelephense extension installed. It's not necessary to have it installed for PHP, but it does come with a few nice features for PHP development that can come in handy. Please keep in mind that there's a premium version of the extension. However, the free version will be more than suitable for most developers.