Phpactor vs Intelephense [Feature comparison]

Phpactor vs Intelephense [Feature comparison] banner

PHPactor and Intelephense are both PHP language servers used to enhance PHP development within integrated development environments (IDEs) or text editors. They provide features like code completion, code navigation, and static analysis to make PHP development more efficient.

Key features comparison PHPactor vs Intelephense

Let's compare key features between these two libraries. All examples are made with Visual Studio Code using the Intelephense and Phpactor extensions.

Note that Intelephense works out of the box whereas Phpactor extension needs to be configured in order to work. More specifically you need to have the Phpactor PHP module installed and you need to specify Phpactor: Phpactor Executable Path in the extensions settings.

Language Server Protocol (LSP) Support

PHPActor Intelephense
Yes ✅ Yes ✅

The Language Server Protocol (LSP) is an open, JSON-RPC-based protocol developed by Microsoft that facilitates communication between integrated development environments (IDEs) and programming language analysis tools. Supporting this protocol would mean that integrating into different IDEs should be straight forward if the IDE itself supports LSP.

Code completion

PHPActor Intelephense
Yes ✅ Yes ✅

Code completion also known as autocomplete is a feature that assists developers by automatically suggesting and completing code as they type. This feature helps save time, reduce typing errors, and improve productivity by providing contextually relevant suggestions based on the code you've written so far.

autocomplete example

Go to definitions

PHPActor Intelephense
Yes ✅ Yes ✅

"Go to definition" is a feature that allows developers to quickly navigate to the location in the code where a symbol (such as a variable, function, class, etc.) is defined. When you use this feature, the IDE or code editor sends a request to the language server using the LSP. The language server processes the request, identifies the definition of the symbol, and sends back the location information. This allows the editor to highlight or open the file where the symbol is defined. Both libraries support go-to definitions.

go to definition example

Find all references

PHPActor Intelephense
Yes ✅ Yes ✅

"Find all references" is a feature commonly found in integrated development environments (IDEs) and code editors that allows developers to quickly locate all the places in their codebase where a specific symbol (such as a variable, function, class, or method) is referenced or used. This feature is invaluable when working with large codebases or when you need to understand how a particular symbol is being utilized throughout your project.

Find all references example

Change all occurrences

PHPActor Intelephense
Yes ✅ Yes ✅

"Change all occurrences" is a feature available in many integrated development environments (IDEs) and code editors that allows developers to make a global change to all instances of a particular symbol (such as a variable name, function name, or class name) within a codebase. This feature is particularly useful when you want to refactor your code by renaming a symbol consistently throughout your project.

change all occurrences example

Hover

PHPActor Intelephense
Yes (Limited) ℹ️ Yes ✅

The "hover" feature provides developers with instant information about a symbol, such as a variable, function, class, or method, by simply hovering the mouse pointer over that symbol in the code.

Here Intelephense shines, because the hover function gives more information and links to official docs.

hover example

Conclusion

During my testing, I can conclude that both extensions work well. I will give Intelephense a slight advantage since it was easier to configure (works out of the box) and it has a better implementation for some of the features (like Hover) for example.

Intelephense also is quite popular in the Visual Code Studio extensions market, it has almost 10 million downloads, whereas Phpactor has only 1.7k. Phpactor deserves more, give it a short, it is worth it!

Note: I haven't tested the premium version of Intelephense.