Even tho PHP 8 was officially released on November 26, 2020, you could already use its new syntax with PHP Tools before that date, and install PHP from sources. Now the release is available for the Windows platform and it can be installed on your development machine in an easy way.
PHP project in Visual Studio gets configured on the project properties page where you select the project server and the project language version.
After selecting PHP 8, the code editor, code validation, and the entire IntelliSense will treat your code as PHP 8 compatible. Moreover, upon running the project (press F5
to run and debug), PHP Tools will ask you if you'd like to install the new PHP 8 including the corresponding debugging support (Xdebug 3).
Click Continue and let the automatic installation to download and configure the necessary software for you.
That's it. The application is now running on PHP 8, you can put breakpoints, inspect variables, step through the code, and get full PHP 8 experience inside Visual Studio.
The new major version of PHP introduces performance improvements, consolidated error handling, new language features, and functions. Maybe most importantly, well known frameworks such as Laravel are upgrading and taking advantage of it. Let's list the most significant new features:
function juggle(int|float $number)
match
expression which is a switch
but as an expression. Or throw
as an expression, so you can write it as a part of conditional expressions. And more.There is many more changes, see the official changelog for the complete information including the corresponding RFCs: https://www.php.net/releases/8.0/en.php
The installation, debugging, and editor features are available to all Microsoft Visual Studio versions since 2010 up to the newest 2019.