Phpstorm Xdebug Symfony



Here, I’m going to talk about configuring XDebug with PHPStorm and Docker.

  • PhpStorm 2020.3 is now available! This major release includes full support for PHP 8, static analyzers PHPStan and Psalm, Xdebug 3, Tailwind CSS, collaborative development via Code With Me, and much more. Download PhpStorm 2020.3 What's New in PhpStorm 2020.3.
  • The Symfony Request::getHost method might be vulnerable to some of these attacks because it depends on the configuration of your web server. One simple solution to avoid these attacks is to whitelist the hosts that your Symfony application can respond to. That’s the purpose of this trustedhosts option. If the incoming request’s hostname doesn’t match one of the regular expressions in.
  • Phpstorm xdebug. Configure Xdebug - Help, Configure Xdebug in PhpStorm On the PHP page, choose the relevant PHP installation from the CLI Interpreter list and click the Browse button To enable PhpStorm to activate Xdebug when it is necessary, specify the path to it in the Debugger extension field, in the Additional area. Type the path manually or click and select the location in the.

ℹ️ Important note: I will not talk about using it in an HTTP context. I have struggled so much in the past and never succeeded in configuring this, and I will probably never do it anyway.
I’m only using it when testing, with PHPUnit or Behat, and that’s perfect: it forces me to write more tests.

Having a working Docker environment

First of all, if we talk about Docker, you may refer to the series of blog posts I wrote about Docker, it might help you.

I will now consider you have a working PHP + Docker environment.

I also consider you already installed the Docker plugin for your PHPStorm IDE.

This is an important step because PHPStorm assumes that the root directory from the incoming request is the public folder (if using either Symfony or Laravel). Make sure you also choose Xdebug as the debugger and use the appropriate HTTP port. PhpStorm + XDebug + Symfony not working. Using xdebug with PhpStorm. PrestaShop 1.7 with PHP Xdebug getting exception and exclude files in script not working. Using Xdebug's bundled debugclient, example of how to set both local and global variables while stepping through a page.

Make sure XDebug is available

Of course now you have a working Docker setup, but remember that XDebug must be present.

I usually install it in my Docker images by adding a RUN statement with (echo ' | pecl install xdebug).
This echo thing is a trick to force pecl to execute in a “non-interactive” mode, in order to let the Docker image be built automatically with no user interaction (which is not possible).

If you have PHP 7.2+, you can even make your debug-based test scripts cross-compatible with any platform thanks to extension loading by name.TL;DR: it means that you can do php -dzend_extension=xdebug instead of php -dzend_extension=xdebug.so for UNIX and php -dzend_extension=xdebug.dll for Windows. Yeah, it’s just about removing the extension.

To know whether XDebug is available, run php -dzend_extension=xdebug -i | grep xdebug.

If all XDebug options are displayed with their default/configured values, it works!

Start configuring!

Okay, let’s see ALL the steps that I go through to set this up.

First, the PHP interpreter

Let’s consider we have a php container running, configured in our docker-compose.yaml file.

PHPStorm will need a PHP interpreter.

For this, go to the File | Settings | Languages & Frameworks | PHP menu.

You should see something like this:

Now, you need to click on the [...] button at the right of the CLI Interpreter section in order to create/use a PHP interpreter.

You might have an existing PHP interpreter, but for the sake of the example, I’ll show you how to configure your PHP Docker container.

Add a new “Remote Interpreter” by clicking on the big + sign:

You should configure the remote interpreter to use Docker Compose and have something similar to this:

If it comes that you have the Server section to be empty, click on New and you may see something like this:

Note: I am using Windows, and I deliberately checked the Expose daemon on tcp://localhost:2375 without TLS checkbox in Docker For Windows configuration.I may update this post in the future for linux-specific config, so check out your docker machine in the first place to see if it can be linked to PHPStorm instead of using the legacy daemon tcp socket.

Here is my final configuration:

Some notes:

  • You should decide on whether you want PHPStorm to use docker-compose run --rm php or docker-compose exec php.
    run guarantees an isolated container, but is slower because it needs to start the container first.
    exec is faster because it connects to a running container, but may have concurrence issues, even though it’s rare (feel free to share experience on that!).
  • You can add Environment Variables for each interpreter. That’s nice if you want a “test-optimized” or a “profiling-optimized” one, etc.
  • Note the Debugger extension field: if you write xdebug (or xdebug.so or xdebug.dll for PHP<=7.1), PHPStorm will automatically append -dzend_extension=xdebug when running a script in “Debug Mode”.

Phew! Now we have PHP, let’s install PHPUnit!

PHPUnit

You may have noticed that I’m a big Symfony fan, so we will take the example of a Symfony project here.

First, I do composer require phpunit. This will install the symfony/test-pack package, which is a package that requires a few other packages, with in particular the symfony/phpunit-bridge package.

The Symfony PHPUnit Bridge component comes with a modified version of PHPUnit (TL;DR: it’s a wrapper around PHPUnit) that will allow you to not require PHPUnit in your composer.json file. This might save some dependencies issues, because PHPUnit and your project might depend on same packages with different versions, and you don’t want that. Apart from that, the component provides some other nice features you may check on the docs.

Apart this “dependencies conflicts” theory, the PHPUnit team decided to use PHP-Scoper for their PHAR version, so if you use the phpunit.phar file, you will not have any conflict either, and that’s okay.

The good thing about this is that requiring it like this on a modern Symfony 4/5 project will install the PHPUnit Bridge Flex recipe that commes with a nice bin/phpunit script.
Very convenient for command-line, but don’t use it with PHPStorm (I will talk about this later).

Right after your composer require phpunit, execute bin/phpunit --version.

The wrapper provided by Symfony will install PHPUnit, find a good version for your system.

You can still override the version in the phpunit.xml.dist file created by the Flex recipe. I personally always update.

By default (as of the time I write this post), PHPUnit is installed via a big composer create-project command (you can find it here) into your bin/.phpunit/phpunit-{version}/ directory.

This point is important, because we will configure the PHPUnit “Run configuration” in PHPStorm by using this specific configuration.

Now! Comes the moment where we move back to PHPStorm!

First, click on the Add Configuration... button on the top-right section of your PHPStorm screen:

Then, add a PHPUnit configuration:

An empty PHPUnit configuration never works.

PHPStorm needs many things for it to work:

  • A working PHP Interpreter
  • A way to execute PHPUnit (autoloader, include path, executable…)
  • An optional configuration file (but we must set it anyway, else PHPStorm’s PHPUnit process will not use the phpunit.xml.dist file at all)

So, to make it work, configure PHPUnit:

Add a new PHPUnit configuration with a Remote Interpreter:

Select the remote interpreter you created with your Docker configuration.

Then, we will tell PHPStorm to look for the PHPUnit executable.

When we ran bin/phpunit --version, the bridge installed PHPUnit in bin/.phpunit/phpunit-{version}, remember? We will pick the executable from there.Important: remember that the script path will be inside the Docker container, so be careful about paths.

Also remember to fill the Default configuration file field, else PHPUnit will not use any config.

Note: You might have slight differences in paths and versions depending on your Docker and PHPUnit configuration.

After that: PHPUnit is configured!

And for XDebug, we installed it.

Run a PHPUnit script in Debug mode with step-by-step debugging

To run in Debug mode, you have the little bug icon next to the “Run” button in your “Run configuration” top bar:

Click on it, and see if your project is tested!

Now, we’ll do step-by-step debugging, thanks to XDebug and PHPStorm’s integration.

Find some piece of code you want to test, and add a breakpoint. To do so, you can left-click in the left gutter of the line you want to stop by when running the test, or you can also place the cursor on the line and press Ctrl+F8 (Windows keymap).

Now, DEBUG!

The test will execute and PHPStorm will open a brand new tab so you can debug everything: stack trace, variables state, etc.

You can now start your step-by-step debugging, thanks to these buttons:

These buttons allow you to execute current line and go to next instruction, step into the function/method call, step out of the current function, etc.

Have fun doing better debugging than dump($var);exit;!

Late notes:

Why do I choose to not use bin/phpunit?

Well, because it simply does not run with PHPStorm.

The reason might be that as it is a wrapper around PHPUnit, Symfony adds features to it (or removes some), especially the one that installs PHPUnit in the first place.
Then, PHPStorm needs to execute this script before finishing the config, because it needs to know which version of PHPUnit is installed (either for auto-completion, autoload, or maybe PHPUnit-specific stuff I am not aware of).
The wrapper does not return the same contents than the native PHPUnit script, so PHPStorm will consider it either not working or incompatible.

This is why I use the native PHPUnit script that is installed by executing bin/phpunit --version

NewsletterReleases

PhpStorm 2020.3 is now available!

This major release includes full support for PHP 8, static analyzers PHPStan and Psalm, Xdebug 3, Tailwind CSS, collaborative development via Code With Me, and much more.

Read on for details on all the new features and significant updates, along with a ton of GIFs!

  • PHP 8: support for all language features, and even open-source Custom Attributes.
  • PHPStan and Psalm can detect issues directly in the code editor or in batch mode.
  • Xdebug 3 with streamlined configuration, and Debugger Improvements such as inline watches and interactive hints.
  • HTTP Client can now run Guzzle requests and copy requests as cURL.
  • Collaborative Development lets you share your project with others and work on it together in real-time.
  • In the Editor, you can now render diagrams and charts with Mermaid.js, split tabs easier, and instantly preview files without opening them.
  • All sorts of IDE enhancements: Search Everywhere got some new moves. IDE visual theme stays in sync with the OS. Setting PhpStorm as a default application for opening files.
  • Git stage is now supported as an alternative to changelists.
  • Database Tools bring support for SQL for MongoDB and new data extractors.
  • Tailwind CSS, with coding assistance for Tailwind classes.

PHP 8.0 has already been released. We would like to say a big thank you to all the contributors and the release managers! The folks from PHP even let us participate in creating the announcement page – check it out.

PhpStorm 2020.3 supports all of the latest language changes. Here’s what’s available and how you can use it in the IDE.

Set language level from the status bar

The status bar now always displays the current language level of the project. Switch it from there to take advantage of the new features of PHP 8.

If switching is inactive, it means there is a constraint on the language version in the project’s composer.json you should adjust it in that file.

Named arguments

In PHP 8, function and method arguments can be passed by specifying a parameter name. Calls are now self-documented, and optional parameters have become truly optional because you can omit them.

Convert positional arguments to named arguments with the Add name identifiers quick-fix:

PhpStorm highlights arguments if they include a typo or if there is no matching parameter:

If the passed value is the same as the parameter’s default, PhpStorm will grey out the argument and you can safely remove it with a quick-fix:

Developers often use options arrays to pass a set of parameters. With named arguments, this is not necessary because you can specify the parameters you need. And as a bonus, arguments passed this way are type-safe, unlike array elements.

Attributes

Attributes a.k.a. annotations are a new, structured way to specify metadata in PHP. They replace PHPDoc comments.

To create an attribute, declare a usual class and add an #[Attribute] marker on top of it. PhpStorm provides all the expected features here, including highlighting, code completion, finding usages, refactorings, and so on.

PHP itself only validates attributes when you call ReflectionAttribute::newInstance(). Until then, if not accessed via reflection, attributes are ignored completely to avoid having to load classes and create objects.

With PhpStorm, you can see whether attributes are valid or not without running the reflection API. The following rules are enforced:

  • The specified class can really be an attribute.
  • This attribute is applied only in the allowed targets: class, property, method, parameter, function, or class constant.
  • This attribute is repeated only if it has the Attribute::IS_REPEATABLE flag.

Here are attributes in action with Symfony:

Custom PHP 8 Attributes in PhpStorm

Several attributes are available in PhpStorm 2020.3 out of the box under the JetBrainsPhpStorm namespace.

Add them to your codebase right away to get better code completion and more inspections.

If you are using other static analysis tools and you don’t want to get Class not found issues, then you might want to add the attributes package JetBrains/phpstorm-attributes to your composer.json as a dependency.

#[Deprecated]

Like you would with the @deprecated PHPDoc tag, you can use this attribute to mark methods, functions, classes, or class constants that are to be removed in the future.

The main advantage of this new attribute is that you can specify replacements for functions and methods. This will help users of the deprecated functionality to migrate.

Let’s take a look at a real-world example. In the recently released Symfony 5.2, the SymfonyComponentDependencyInjectionAlias::setPrivate()is deprecated. With the #[Deprecated] attribute, we can make migration easier.

#[ArrayShape]

Phpstorm Xdebug Symfony

This attribute is useful for working with simple data structures or object-like arrays when defining a real class may feel excessive.

The syntax is as follows:

The type can be specified as a string or as a class reference in the form of an FQN string or a::class constant.

Here’s an array that defines a shape. Extract it into a constant and then reuse it inside the attributes where it applies:

In PhpStorm, we’ve already annotated some internal PHP functions like parse_url() with #[ArrayShape], so you can benefit from the attributes right away.

Fortunately, the syntax of one-line attributes is backward-compatible. If you add the #[ArrayShape] attribute on a separate line in your PHP 7.* project, the PHP interpreter will parse it as a commented line. However, multiline attributes are not safe for versions of PHP prior to 8.

Unlike the PHP interpreter, PhpStorm will analyze attributes anyway! So even if your project runs on PHP 7.4 or lower, you’ll still benefit from adding #[ArrayShape] attributes.

#[Immutable]

Immutable objects cannot be changed after being initialized or created. Using them makes the program state more predictable and debugging easier.

Mark objects or specific properties with the #[Immutable] attribute to make sure they will not be changed.

PhpStorm will check the usages of objects and properties and highlight change attempts.

You can allow the property to be changed only in a constructor or in private/protected methods too.

To do this, pass one of the constants CONSTRUCTOR_WRITE_SCOPE, PRIVATE_WRITE_SCOPE, or PROTECTED_WRITE_SCOPE to the #[Immutable] attribute constructor.

#[Pure]

Mark functions that do not produce any side effects as pure. Such functions can be safely removed if their execution result is not used in the code afterwards.

If the function is marked as pure but you try to change something outside of it, that is, it produces a side effect, then PhpStorm will highlight the unsafe code.

All internal PHP pure functions are marked as such in PhpStorm.

#[ExpectedValues]

With this attribute, you can specify which values a function accepts as parameters and which it can return.

This is similar to what the expectedArguments() function would do in .phpstorm.meta.php, except that the meta version is more like a completion adversary. The attribute, by contrast, assumes that there are no other possible values for the argument or return value.

For example, let’s take the count function:
Its second argument is an integer, but in reality, it is not an arbitrary integer. Rather, it is one of the constants COUNT_NORMAL or COUNT_RECURSIVE, which correspond to 0 and 1.
See how the #[ExpectedValues] attribute can be useful here.

How to specify possible values or bitmasks.

Expected values are passed to the attribute constructor and can be any of the following:

  • Numbers: #[ExpectedValues(values: [1,2,3])]
  • String literals: #[ExpectedValues(values: [‘red’, ‘black’, ‘green’])]
  • Constant references: #[ExpectedValues(values: [COUNT_NORMAL, COUNT_RECURSIVE])]
  • Class constant references: #[ExpectedValues(values: [Code::OK, Code::ERROR])]

And there are a few ways to specify expected arguments:

  • #[ExpectedValues(values: [1,2,3])] means that only one of the values is expected.
  • #[ExpectedValues(flags: [1, 2, 3])] means that a bitmask of the specified values is expected, e.g. 1 | 3.
  • #[ExpectedValues(valuesFromClass: MyClass::class)] means that any of the constants from the class `MyClass` is expected.
  • #[ExpectedValues(flagsFromClass: ExpectedValues::class)] means that a bitmask of the constants from the class `MyClass` is expected.

#[ExpectedValues] example
Let’s take a look at the response() helper in Laravel. It takes the HTTP status code as the second argument.

This leaves us missing two key features:

  • Code completion for possible status codes
  • Validation in the editor

Let’s fix this by adding the attribute #[ExpectedValues(valuesFromClass: Response::class)]

#[NoReturn]

Some functions in a codebase may cause the execution of a script to stop. Mark such functions as exit points with the #[NoReturn] attribute to get a more accurate control flow analysis.

PhpStorm will offer to propagate the attribute down across the hierarchy, along with a quick-fix to get even more well-defined analysis.

#[Language]

Add this attribute to string parameters that contain text in another (programming) language, such as RegExp, SQL, and so on. This will reveal additional PhpStorm features.

Let’s get back to the PHP 8 features.

Constructor property promotion

To make objects smaller and more readable, you can now initialize variables through a constructor.

Convert constructor properties to promoted properties, or change them back, with the Convert to promoted property quick-fix.

PhpStorm makes sure that promoted properties are only used in the way allowed by PHP 8:

  • Cannot declare a promoted property outside a constructor.
  • Cannot declare a promoted property in an abstract constructor.
  • Cannot declare a variadic promoted property.
  • Property cannot have the ‘Callable’ type.
  • Redeclaration of a property is not allowed.


If the property is promoted but there is a left-over assignment in the constructor body, then PhpStorm will suggest removing it.

Match expression

PHP 8 introduces a new expression match which is similar to switch but uses a strict comparison and can be assigned to a value or returned.

PhpStorm determines if a switch block can be converted to a match and will do it automatically with an Alt+Enter quick-fix:

With the new expression, it might be hard to see inappropriate usages, so PhpStorm will highlight them.

Symfony


Duplicate values in conditions are detected:

A match expression with a single default branch can be safely replaced with a ternary expression.

And if there is only a default branch left, you might not need the match at all.

Lastly, if there are identical bodies in different branches, they can be merged.

Nullsafe operator

Instead of cumbersome conditions with null checks, you can now use a chain of calls with the new ?-> nullsafe operator.

PhpStorm will check that the operator is used correctly:

Trailing comma

It’s now acceptable to add a comma after the last parameter in a function call and in the use list of closures.

Non-capturing catches

In PHP 8, it is possible to catch exceptions without applying them to variables.
Use the Alt+Enter quick-fix to add, or to remove, a variable in a catch statement:

Throw expression

Throwing exceptions is allowed in arrow functions, the coalesce operator ??, and the ternary/elvis operator ? :, which was not possible before.

To quickly add a throw expression, type thr and press tab – this will expand a live template.

Allow ::class on objects

In previous PHP versions, to get an FQN you could do ClassName::class, but on objects you had to call get_class(). In PHP 8, you can safely replace get_class($object) with $object::class.

PhpStorm provides an Alt+Enter quick-fix for that and will also warn you if ::class is used inappropriately.

New functions for strings: str_contains(), str_starts_with(), str_ends_with()

How do I check if a string contains a specific word? – This is the most viewed PHP question on Stack Overflow ever. PHP 8 has a clear answer to that question: use the str_contains() function.

PhpStorm 2020.3 detects strpos() usages that can be replaced with str_contains():

There are also new str_starts_with() and str_ends_with() functions to determine if a string starts or ends with a specific substring. PhpStorm highlights where the old substr() calls can be replaced with new alternatives:

Reclassified engine warnings

In PHP 8 many errors were categorized into new severity levels. Instead of a Warning in many cases you’ll get an Exception or a Type Error.

PhpStorm reflects this, and some inspections have two different severity levels that can be set separately: for PHP 8, and for older versions.

All the other changes in the PHP 8 release are supported too.

Psalm and PHPStan Support

Both static analyzers can be used in PhpStorm 2020.3 to get on-the-fly file highlighting of problems in the editor.

PHPStan

You can add PHPStan or Psalm as your dev-dependency in composer.json. Near the corresponding line, there will be a wrench icon that opens the tool settings.

From there you can go to the Inspection settings and enable highlighting in the editor. Click on the PHPStan Inspection / Psalm Inspection link. To turn on highlighting, select the corresponding inspection in the PHP | Quality tools list.

Here you can specify the configuration file path and adjust the command-line arguments of the tools. For example, you can set PHPStan’s error level or toggle unused code detection for Psalm.

Note: PHPStan can work without a configuration file, but Psalm requires one.
If you have psalm.xml or phpstan.neon in the root directory, PhpStorm will detect them automatically.

Once you have set this up, you can then open any file and see the problems highlighted in the editor. There may be a short delay before the highlighting appears.

Annotations

Code annotated with extended Psalm tags is now valid in the editor, and @psalm-* is correctly highlighted. Though, in most cases, it is now safe to remove the @psalm- prefix from tags, i.e. @psalm-return -> @return and @psalm-param -> @param.

Type support

We’ve added support for some Psalm types and improved our type inference too. Everything that depends on type inference is now more accurate, including inspections, code generation, and completion.

Pseudo-types
This includes scalar, numeric, and so on.

Constants in types
Constant value unions and wildcards are both supported in type definitions via @param and @var.

Array typehints
Type inference for array definitions array<array-key, Type> now works as expected. This applies to nested definitions, too.

Generics with @tempate
We believe that support for generics is an advanced feature that lacks a proper specification and has many edge cases. Yet, we have decided to implement basic support for the @template construct based on the Psalm syntax, to see how it goes.

So far, only a simple scenario, when the function returns one of its parameters, is supported.

This support for generics is basic and still considered experimental. This is where we’d like to understand how you would like to use it and what you’d like to see more of. Please give us your feedback by submitting requests with your real-life template usages to our issue tracker.

Xdebug 3

The PHP debugger extension has received a major update. It is now significantly faster and easier to set up. Learn more about Xdebug 3 in the Upgrade guide.

To configure Xdebug 3, you only need to specify xdebug.mode (e.g. XDEBUG_MODE=debug).
Xdebug’s default debugging port has changed from 9000 to 9003. To ease migration, PhpStorm is now listening on both ports by default. You can adjust the port and other settings for Xdebug under Preferences/Settings | Languages & Frameworks | PHP | Debug.

Debugger Improvements

We’ve made a few improvements to the debugging experience and simplified examining variables.

Interactive hints
Now when you are in debug mode, you’ll get clickable inline hints that you can expand to see all the fields of the variable. You can also change the variable values from there.

Inline Watches
In previous versions, you could see how a certain expression evaluates throughout the steps by adding it to watches.

In PhpStorm 2020.3, you can tie your watch expression to the place in the code where it is relevant.

Click Add as Inline Watch in the hint popup.

Or, choose Add Inline Watch in the editor’s context menu.

Or, select any variable, right-click on it, and choose Add Inline Watch.

Highlight and rename variables in Twig

Select a variable or put the caret on one to highlight all its usages in the template. Use the Shift + F6 shortcut to Rename all occurrences of the variable.

Code With Me for collaborative development

Phpstorm Xdebug Not Working

PhpStorm 2020.3 bundles Code With Me – a new tool from JetBrains for collaborative development and pair programming. Code With Me enables you to share the project you currently have open in your IDE with others, and work on it together in real time. Check out these posts to learn more about Code With Me.

HTTP Client

Guzzle integrated with PhpStorm’s HTTP client

Guzzle is one of the most popular HTTP clients for PHP. Imagine there is an HTTP request somewhere in the code. If you wanted to test it without running your actual code, you’d have to go and copy all the parameters manually.

PhpStorm 2020.3 lets you convert simple Guzzle requests to .http files. If the request is supported, there will be a gutter icon next to it. Clicking it will create a new scratch file with the correct URL, query parameters, methods, headers, body, and simple auth. You can then run it directly from the code editor with the IDE’s internal HTTP client.

You can play around with the request and then save it as an .http file in your project.

Learn more about HTTP client in the video overview.

Export HTTP Requests to cURL

To export an HTTP request to a cURL string, press Alt+Enter in the HTTP request editor and select Convert to cURL and copy to clipboard. Use it in the terminal, documentation, or any API testing tool.

Editor

Phpstorm Xdebug Ssh

Markdown editing and preview enhancements

Use the Mermaid.js syntax in markdown files to describe diagrams and charts. PhpStorm can render a preview for them right in the editor. Enable it in Preferences/Settings | Languages & Frameworks | Markdown.

You can now reformat the content of your .md files to conform to popular Markdown style guides. To do so, press ⌘⌥L / Ctrl+Alt+L. You can modify the related code style settings in Preferences/Settings | Editor | Code Style | Markdown.

Finally, if you click the Auto-Scroll Preview button in the top right-hand corner of the preview pane, that pane will scroll along with the editor.

Improved spelling and grammar checking

You can now address grammar and spelling issues faster:

  • The popup for a mistake will show an explanation and a suggested fix.
  • And if you press Alt+Enter over the highlighted text, you will see all the suggested replacements in the top level, instead of a nested list like before.

Split the editor with drag and drop

If you want to open files side by side, just drag a tab to the desired corner of the screen and drop it there.

There’s one more way to split the editor – Shift+Enter.
Press this key combination on a selected file in Project view or Find results.

Preview Tab

If you want to quickly skim files, you don’t have to open them. Just use the new Preview tab.

To enable it, click the gear icon in the Project view and select both Enable Preview Tab and Open Files with Single Click.

You can now also preview with the Space key in Project view.

IDE

Search Everywhere improvements

Results grouped by relevance:

Simple math in Search Everywhere:

Search through Git history:

Switch to light or dark theme automatically

Go to Preferences/Settings | Appearance & Behavior | Appearance | Theme and select the Sync with OS option there.

System shortcut keymap for macOS

An alternative macOS keymap avoids using function keys for essential actions. For example, instead of Fn+Shift+F6 for the Rename refactoring, it’s just ⌥+⌘+R.

macOS shortcuts as words
If you are struggling to read the macOS shortcuts, try toggling the ide.macos.disable.native.shortcut.symbols key in the registry. To access the registry, use Find ActionCmd+Shift+A and then type Registry.

Phpstorm Xdebug Docker Cli

Set PhpStorm as the default application for opening files

Go to Preferences | Settings / Editor / File Types and click the Associate file types with PhpStorm… button. In the dialog, select the extensions for files you wish to open in PhpStorm.

On macOS, you will need to restart your computer to apply these changes.

Templates can now generate multiple files

You can generate a bunch of boilerplate files at the same time, for example, a skeleton for a module or a controller-view combo.

Go to Preferences / Settings | Editor | File and Code Templates and click to create a new template, and then click on the Create Child Template File icon .

In the File name field, you can specify a pattern to generate a filename and path using predefined variables like ${NAME}.

Here’s how the files are generated:

Git stage support

PhpStorm 2020.3 comes with support for the Git staging area. To turn it on, tick the Enable staging area checkbox in Preferences/Settings | Version Control | Git.

In the Commit tool window Cmd+0 / Alt+0, you’ll see the staged and unstaged files.

Stage files by clicking on the + icon near them.

Or stage specific lines by using the gutter icon near the changes in the editor. This way, you can commit some changes in a file and keep the rest uncommitted for further work.

Database Tools

PhpStorm includes almost all of DataGrip’s features as standard. Check out What’s new in Database tools for an overview of the new features we’ve added for working with databases.

SQL for MongoDB

You can now use SQL to query MongoDB databases. PhpStorm 2020.3 supports SELECT queries with clauses such as JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, OFFSET, and all available MongoDB functions except map, reduce, filter, and let. If you want to learn more about SQL for MongoDB, read this blog post.

New data extractors

We’ve also introduced two new extractors: One-Row, which allows you to copy a column to a comma-separated string; and SQL-Insert-Multirow, which generates a single INSERT statement with multiple new rows to be inserted.

Web

As usual, all the updates for WebStorm 2020.3 have also been incorporated into PhpStorm. The most notable is Tailwind CSS support.

Tailwind CSS

First, you can now expect PhpStorm to autocomplete Tailwind classes in your HTML files and after the @apply directive. You’ll also see completion suggestions for pseudo-class variants.

Hover over a class in your HTML and CSS files to see the preview of the resulting CSS. You can also see this preview when autocompleting your code, thanks to the Documentation popup F1 / Ctrl+Q.

PhpStorm also supports the customizations you make with tailwind.config.js files. The IDE analyzes these files and provides completion based on your customizations. If you define a custom theme with new colors, for example, you’ll see newly generated classes with the name of the custom color in the completion popup.

The full list of changes in PhpStorm 2020.3 is available in the really long release notes.

That’s all for today. Thanks for reading to the end!

  • Download PhpStorm here.
  • Tweet @ us!
  • Report bugs to our issue tracker.

Php Docker Xdebug Phpstorm

Your JetBrains PhpStorm team
The Drive to Develop