UML Diagrams in PhpStorm 2017.2
Unified Modelling Language can be used to draw out the relationships between classes, abstract classes, and interfaces, to help you to visualize exactly how your classes interact and are related. PhpStorm has tools that can help you to create these diagrams, and manipulate your code from within the chart.
To create a UML diagram, use the context menu (right click) on the class name (or even a folder of classes or the whole project) in the project pane, and select Diagrams | Show Diagram…
This shows how the `IndexController` extends the `AbstractActionController` which extends the `AbstractController`, which implements three interfaces. This can be very useful to visualize the object hierarchy, but you can manipulate your code from within the diagram view, as well as modify just the diagram.
You can add notes to the chart from the context menu New… | Note which can be useful for explaining what each abstraction is for. Pressing C allows you to Collapse nodes, and pressing E allows you to expand nodes by their namespace. This is useful for navigating around the tree, as expanding nodes will add classes to the diagram if they aren’t already there. You can also add classes to the diagram by pressing Space.
You can usefully show and hide methods, properties, constants, and the constructor either from the context menu or by using the diagram menu at the top of the diagram. Showing methods and properties is particularly useful as it allows you to see exactly which entity a method or property is implemented in.
You can also refactor the entity from the context menu – the whole Refactor menu is available for each object, so, for example, you can rename an interface by right-clicking on it and selecting Refactor | Rename.
New in PhpStorm 2017.2 is the chance to add code to your entity by using the New… | Create New Field or Create New Method context menu items. The UML diagram can be very handy for having a good overview of your application, and the new refactoring abilities from within the chart will hopefully make it an even more useful tool. You can learn more about UML diagrams from this tutorial in the documentation.
– Gary & The PhpStorm Team
Subscribe to Blog updates
Thanks, we've got you!
Qodana Clone Finder: Early Access Program
In December 2020, we announced the EAP for Qodana, which is rapidly evolving into a comprehensive platform that allows companies to perform multi-level evaluations of the quality of code they own, contract, or purchase. Qodana helps you detect bugs without relying on an IDE, either on a local machi…
PhpStorm 2020.2 EAP #3
The Early Access Program for PhpStorm 2020.2 is in full swing and today we’ve got the third build of the 2020.2 EAP for you. In this blog post, you can read about improvements for Git installed in WSL2 and Search Everywhere. Download PhpStorm 2020.2 EAP (more…)…
PhpStorm 2019.3.3 Preview
We’ve just rolled out a preview for the third minor update for PhpStorm 2019.3. Please give the PhpStorm 2019.3.3 Preview build 193.6494.5 a try and share your feedback with us. (more…)…
How to Upgrade to PHP 7.4 with PhpStorm
Check out our fresh video with a few nice tips and tricks on how to update your codebase to PHP 7.4. It combines materials from the PhpStorm 2019.2 and PhpStorm 2019.3 releases, with a few cool bonuses to boot. Nikita drew our attention to the fact that setters are slower than assigning prop…