Phpstorm



  1. PhpStorm will now support developing in a WSL (Windows Subsystem for Linux) environment, which is when you have launched your IDE on a Windows 10 machine, but you target WSL/Linux in your development. You’ll be able to specify a remote PHP interpreter in the WSL and use it for running scripts, tests, Composer commands, and debugging.
  2. PhpStorm substituted a template with a complete foreach cycle and prepared stubs for all necessary variables. You just need to fill in correct variable names. If you press Ctrl + J, you’ll see the list of currently supported live templates, applicable for the current place of the code. You can choose any of them.
  3. I am able to change my PHP Storm (version 8.0.3 or later) Fonts by Go to File and then click Settings. Form Left Side Menu, Select Editor - General Tab Check this box under Mouse section Change font size (zoom) with CtrlMouse Wheel (see below pic).
NewsNewsletter

PhpStorm 2019.3 is now available!

This major release is focused on performance and quality, expect a more stable and faster IDE. It also brings full support for PHP 7.4, PSR-12 code style, WSL for remote interpreters, MongoDB support, HTTP Client updates, and many usability improvements!

PhpStorm Command Line comands generation plugin. Contribute to skie/PhpStorm development by creating an account on GitHub. Install PhpStorm on your Linux distribution Choose your Linux distribution to get detailed installation instructions. If yours is not shown, get more details on the installing snapd documentation.


In this blog post, we’ll provide a detailed overview of all the changes and things that you should know about this new version. It’s a combination of all the EAP blog posts that we’ve been publishing here over the past several months plus many other useful additions that have not yet been covered. Fasten your seat belts as we have a ton of GIFs for you!

Performance and Quality

Every release we dedicate a significant amount of time to performance and quality. But for this release, we went even further and held a full-blown quality-marathon. During this time the whole IntelliJ Platform team focused on polishing the IDE and making performance improvements. And we have achieved the following results:

  • Faster IDE startup
  • Better UI responsiveness
  • Reduced memory consumption

Depending on your platform, you should see much faster IDE loading. Because we parallelized some of the processes that used to run sequentially, we reorganized the classes in a way that makes the initial class loading faster, and much more.

We were able to resolve a number of issues that were responsible for over 1600 reports of UI freezes.

There are performance optimizations in the Version Control subsystem too. We’ve managed to revamp the processing of events and the handling of ignored files. There are fewer freezes and faster status updates in large projects.

We plan to continue working on this, so you can expect even faster startup and more optimizations to come in the next few releases.

PHP 7.4

PHP 7.4 is now released! It has so many cool things on board. Just check out the new features there. All of them are supported in PhpStorm 2019.3.

Typed Properties

This is probably the most anticipated feature of PHP 7.4. PhpStorm has supported it since 2019.2. Let’s take another look at it, as in this release we’ve fixed a few issues with it and covered some corner cases.
First of all, PhpStorm will, of course, highlight type violations:

It is more likely than not that you will want to quickly add type declarations for your properties. This should be quick as PhpStorm can detect the type of the existing properties based on the PHPDoc, default value, or if you have a defined type when you injected the value into the constructor.
Anyway, you can press Alt+Enter on a property without a type, and then choose Add declared type for the field and that’s it, it’s done.

Phpstorm File Watcher

Arrow Functions

If you have an anonymous function with a single statement in the body, in PHP 7.4, you can now convert it to a short arrow function: fn(parameter_list) => expr

And there is no need to write use section as it has an automatic by-value binding of outer scope variables:

Press Alt+Enter on the anonymous function and use Convert closure to arrow function option:

Numeric Literal Separator

You can now add underscore symbols anywhere in the numbers to visually format them. Press Alt+Enter on any number and apply Add number separators. This will add an underscore ‘_‘ after every third digit for decimal numbers, or every fourth digit in hex, binary, and octal.

Nested Ternary Operator

Almost all programming languages compute the ternary operator from right to left. PHP did it differently, which was counterintuitive and could lead to mistakes. Now, PHP 7.4 deprecates left associativity. This means that you either should not be using nested ternaries at all, or if you have to, then you should use parentheses to explicitly declare the order of computation.

PhpStorm 2019.3 highlights deprecated expressions, and you can use a quick-fix (Alt+Enter – you know, right?) to clarify the behavior.

New Serialization Mechanism

As the issues with existing serialization were not fixable, the PHP core team decided to introduce two new magic methods __serialize() and __unserialize(). PhpStorm will help find usages of those methods in the code:

Covariant Returns and Contravariant Parameters

PHP 7.4 fixes multiple inconsistencies, and one of them relates to the type system. When you work with a method inherited from a parent class, it will now be possible to define a more specific return type, and less specific parameter types for it.

Deprecations

The good thing about PHP releases is that they not only add new features but also deprecate old ones, making the language cleaner and more pleasant to work with. The PHP 7.4 release comes with a whole bunch of deprecations.

PhpStorm 2019.3 highlights code pieces that need your attention. Where possible, you’ll have an option to quick-fix the deprecated behavior automatically.


⚠️ With the PHP 7.4 release, older versions of PHP are going to be abandoned. PHP 7.2 goes into security-fixes-only for one more year. PHP 7.1 is now officially not supported. This means that if a vulnerability is now found, there will never be a fix for it and getting hacked is just a matter of time. Get ready to upgrade.

PSR-12

This new PSR-12 standard supersedes the dear old PSR-2, adapting it to all the new language features that we’ve been given in the last years, and cleaning up a few inconsistencies. Kudos to PHP-FIG for this great update! If you’ve been using PSR-2, check out what has changed in PSR-12.

PhpStorm 2019.3 comes with a predefined PSR-12 code style, and the IDE will suggest that you switch to it. You can also always switch to it manually with the Set from… action under Preferences | Editor | Code Style | PHP:

Some PSR-12 rules are added as inspections which are off by default, but PhpStorm suggests to turn on the inspection when you choose the PSR-12 code style. You can adjust the inspections as you like, under Preferences | Editor | Inspections in PHP | Code Style | PSR-12:

After this, you can reformat code in the editor by pressing Cmd/Ctrl+Alt+L:

Or you can have PhpStorm run it automatically on the cleanup stage before a commit:

WSL

PhpStorm will now support developing in a WSL (Windows Subsystem for Linux) environment, which is when you have launched your IDE on a Windows 10 machine, but you target WSL/Linux in your development. You’ll be able to specify a remote PHP interpreter in the WSL and use it for running scripts, tests, Composer commands, and debugging.

  • To get started, make sure you have installed the WSL on your Windows 10 machine, and the Linux distribution of your choice. See the installation guide.
  • Depending on the distribution you may have PHP already preinstalled. If not, you’ll have to install it manually via the command line. For example in Ubuntu you can run something like this:
    sudo apt update
    sudo apt install php php-mbstring php-dom php-xml php-zip php-curl php-xdebug
  • When you have PHP in your WSL environment you’re ready to set up PhpStorm.
  • Add a CLI interpreter under File | Settings | Languages & Frameworks | PHP

That’s all there is to it! Now you can specify this interpreter for running tests, Composer, or for any other run-configurations that you have.

PHPDoc Improvements

Traditionally in PhpStorm, you had resolving for FQNs and links in PHPDoc, but the whole block was displayed in one color and styled just like regular comments.
In PhpStorm 2019.3, doc blocks get full highlighting for all the types, variables, params, methods, and properties. If you have HTML in your comments, it will also be highlighted as such.

PHP Highlighting in Markdown and Strings

Phpstorm

Sometimes you may need to use PHP inside a string literal. We hope it’s not in eval(), but you get the point. Or maybe you want to get PHP highlighting in code blocks in Markdown files.

In PhpStorm 2019.3, you get all of these, thanks to a special PHP dialect called InjectablePHP. This dialect works similar to PHP, but the opening tag can be omitted.
It will be automatically injected in markdown fences with the info string equal to php:

Heredoc/Nowdoc strings with PHP marker:

Well, and in eval() calls too:

Handy little improvements

Quick-fixes for conditions

The conditional if-else statement is probably the most used construct in the language. So in PhpStorm 2019.3, we’ve added a few nice and quick actions to manipulate conditions.

If you have an assignment inside an if statement, PhpStorm will suggest extracting it to a variable with Alt+Enter:

If you have nested if conditions, it is now possible to quickly merge them into one with Alt+Enter:

You can merge else followed by if into a single elseif:

Or you can do the opposite and split elseif into else and if:

Inline constant refactoring

This refactoring is opposite to the Extract constant and it results in replacing constants occurances with value. Press Cmd/Ctrl+Alt+N on constant.

Discover many more refactotings by pressing Cmd/Ctrl+T.

Unwrap function argument (remove function call)

Press Shift+Cmd/Ctrl+Delete to remove redundant function call:

Auto-insert <?php when just <? is typed in

Short tags are likely to remain a part of PHP, at least for the next few years, as the last RFC vote did not pass.But PhpStorm can help you with deprecating short tags, by automatically inserting <?php as soon as you type <?:

Automatically complete ‘=’ to ‘=>’ after array key

There’s another little timesaver we’ve included in 2019.3. When you are adding an item into an array, and you type a key and then want to type => to specify a value, just press = and PhpStorm will automatically insert =>:

Other PHP-related updates

Specify the interpreter for PHP test run configurations

Previously, if you wanted to, let’s say, run tests in PhpStorm with a remote PHP interpreter, you had to create a separate run-configuration. In PhpStorm 2019.3, we’ve added interpreter option for any php run-configurations, so you can choose any interpreter that you have to run your tests with. Feel free to use Docker, Vagrant, or any other remote interpreter too.

Fonts & colors for $this variable

HTTP Client

Editor Toolbar

Whenever you open an .http or .rest file, you have a toolbar with quick access to common actions:

Run All Requests in File

Phpstorm

With the editor-based HTTP Client in PhpStorm, you can write multiple requests in one .http file by separating them with ###. This is quite convenient if you need to do request chains when one request depends on the result from previous ones.

Earlier, you had to run each request one by one, now in PhpStorm 2019.3 you can run them all at the same time.

Folding requests

If you are sending a request with a long body, for example, multipart form data or maybe many headers, you may want to fold it to reduce noise in the editor.
You can fold the whole request leaving the first line, or only the body part:

Completion for hosts

When composing a new request, you no longer need to type the hostname you used earlier. PhpStorm will offer you a list of hostnames in the suggestion list:

Dynamic variables

We’ve added three dynamic variables that you can use anywhere in the requests:

  • $uuid – Generates a new UUID-v4 (e9e87c05-82eb-4522-bc47-f0fcfdde4cab)
  • $timestamp – Current Unix timestamp (1563362218)
  • $randomInt – A random integer between 0 and 1000

Use double curly brackets to insert one of these variables where needed:
GET http://httpbin.org/anything?id={{$uuid}}&ts={{$timestamp}}

See all the essentials you need to know in the video overview of
HTTP Client in PhpStorm.

Version Control

Reworked UI for cloning projects

Now you can log into GitHub from this dialog, or if you’re already logged in, the IDE will instantly preview lists of all the repositories which will be grouped by accounts or organizations.

Checkout

We’ve removed the Checkout as action and introduced 2 new separate actions instead: New Branch from Selected and Checkout. The new New Branch from Selected action creates a new branch and doesn’t set tracking. The Checkout action silently creates a new local branch, checks it out, and sets tracking of the selected remote branch if there is no local branch with the same name.

Push any branch

You can now push changes from any branch without switching to it. In the VCS | Branches popup – select a branch and then use the Push action from the menu.

Date format customization

Phpstorm

You can configure the date format for VCS Annotate and VCS Log actions. For example, you can set it to mm/dd/yyyy if you want to use the US format.

IDE

Better plugin management

PhpStorm has lots of incredible plugins that you can install to extend its functionality and customize its appearance. Managing plugins was a bit of a hassle, as it required restarting the IDE each time. We’ve addressed this issue in PhpStorm 2019.3 by implementing core underlying infrastructure – support for dynamic plugin installation. This basically means that the IDE can now load and unload plugins without restarting. It is currently enabled for the theme and keymap plugins. In future releases, we plan to extend this to most plugins.

Contrast scrollbars

The scrollbar can now be made more visible thanks to the “Use contrast scrollbars” checkbox at Preferences/Settings | Appearance & Behavior | Appearance.

Smooth mouse scrolling

If the option Smooth scrolling is enabled under Preferences | Appearance & Behavior | Appearance, the entire interface will scroll smoothly instead of line by line when using a mouse wheel/touchpad.

Search within selected text

Select the code piece you need in the editor and invoke the Find action by pressing Cmd/Ctrl+F and the IDE will search only in the selected area. If you need to extend the search area and search throughout the whole file, press Cmd/Ctrl+F again, or alternatively toggle the In Selection option in the toolbar.

New editor command to sort lines alphabetically

Phpstorm Download

Now you can easily sort lines alphabetically by selecting lines in the editor and choosing Edit | Sort Lines from the main menu or by running this action from Find Actions by pressing Cmd/Ctrl+Shift+A:

Web Technologies

See all the changes made by our colleagues from the WebStorm team on the What’s new in WebStorm 2019.3 page. Everything mentioned there is incorporated in PhpStorm 2019.3 as well.

Database Tools

MongoDB support

The day has finally come for us to start working on MongoDB support.
What actually works in this version:

Introspection
You can observe collections and fields in the database explorer. We fetch the first 10 documents from each collection to get information about the fields. This can be customized via the JDBC parameter fetch_documents_for_metainfo which is available in the Advanced tab of the data source properties dialog.

Data viewer
Open any collection or observe the query result and you have the option to sort by columns or filter the values, also paging works as well.
It’s also possible to explore data as a tree. To turn it on, click the Gear icon | View as… | Tree.

Query console
There is currently no coding assistance, but this doesn’t stop you from running queries and getting back the results. To run a statement, put the caret on it and run it via Cmd/Ctrl+Enter or by using the Play button on the toolbar.
Completion for queries will come later.

PhpStorm includes all the features of DataGrip out of the box, so there are many other new things to discover in DB tools. Stay tuned for a detailed overview of the DataGrip 2019.3 release.

A full list of all the changes in this release is available in the really long release notes.

That’s all for today. Thanks for reading till the end! Send us your questions, suggestions, bug reports, and just your thoughts in the comments.

Your JetBrains PhpStorm Team
The Drive to Develop

JetBrains PhpStorm is one of the best development IDE for PHP developers. However, according to PHP community it’s license price is costly specially who want to learn. It’s one of the modern IDE till now for PHP. Today I am going to show how to run PhpStorm from terminal in Linux machine (Ubuntu, CentOS and other platform). Also I will describe about to create PhpStorm launcher in Ubuntu and other Linux OS. From the command line even you can run PhpStorm as root. But remember, running any application with root privilege requires double thinking because it’s risky. Try to avoid opening application without root.

Download & Install PhpStorm

Before going further down, you need to download PhpStorm first. To download JetBrains PhpStorm, you need to go to https://www.jetbrains.com/phpstorm/ website and click on the download button. It will download the latest version based on your operating system. For Ubuntu, it will be tar.gz file. After downloading extract that and keep it in a directory. For this tutorial, I have extracted PhpStorm in /opt directory.

Run PhpStorm from terminal as normal user or root

It’s sometimes uneasy to open file explorer and find the PhpStorm executable to run it. For most of the linux system we prefer to run any application directly from terminal as root or as normal user. But unfortunately PhpStorm doesn’t provide any installer. So we have to create our own command, create own launcher for our Ubuntu and any other Linux OS.

To run PhpStorm from command line, you need to create a symbolic link of the original executable as a binary. To do that, run the following command to create PhpStorm symbolic link to /usr/bin/phpstorm.

In the above code /opt/PhpStorm-121.390/bin/phpstorm.sh is your PhpStorm’s phpstorm.sh executable file location and phpstorm word from usr/bin/phpstorm this is the assigned command to run PHPStorm IDE from your terminal.

In the above command, change your directory as per your downloaded version. And /usr/bin/phpstorm you can make it however you want. If you want to run PhpStorm as another name like yourname. You can create that symbolic link to /usr/bin/yourname.

OK, now you have the binary located in bin directory. You can now open PhpStorm from terminal with the following command.

Run PhpStorm as sudo

Everything is same. Just add sudo before the command. So the final command to run open PhpStorm from terminal with sudo privilege is –

Create PhpStorm Launcher in Ubuntu

Sometimes we don’t feel OK to run anything from terminal because of wrong command or we forget some useful commands. In that case specially if we use Ubuntu. Then we can directly create launcher icon of PhpStorm so like other program, we can just run PhpStorm by clicking on the icon. Sounds cool!

Phpstorm Wsl2

Now to create launcher in Ubuntu Unity we just need to create phpstorm.desktop file in /usr/share/applications with the following snippet :

Phpstorm

Create phpstorm.desktop file by typing the following command :

Phpstorm M1

Then write the following code in newly created blank text file.

Save this file and restart your terminal. And type the following command to run PhpStorm. After running it first time you can pin it to the sidebar or you will get the PhpStorm icon. Great! So today I just told you how to run PhpStorm from terminal in Ubuntu and create launcher icon in Ubuntu for PhpStorm.

Phpstorm Activation Code

Happy PHP-ing. If you face any problem to create PHPStorm launcher in Ubuntu machine let me know.