Book Image

PhpStorm Cookbook

By : Mukund Chaudhary
Book Image

PhpStorm Cookbook

By: Mukund Chaudhary

Overview of this book

Table of Contents (16 chapters)
PhpStorm Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Customizing a view


There are times in the life of a software engineer when nothing seems to be going right, and hence the only thought that comes to mind is to change everything.

PhpStorm takes care of that time period as well and provides customization to the views—you can customize the way views appear.

How to do it...

There are two roads that can take you to the world of customization:

  • The Settings button available in the top-right corner of the individual view, as shown in the following screenshot:

  • The other very easy option and the most familiar friend of yours is the right-click context menu on the title bar of the toolbar.

How it works...

In general, there are some context menu options available to all the views, such as the orientation modes: floating, docked, pinned, and split. The views can be in:

  • Floating Mode: The views are free to be located anywhere on the screen

  • Docked Mode: The views do not disappear automatically on losing focus

  • Pinned Mode: The view stays at one location until changed

  • Split Mode: You can have multiple views shown at a time

The Show View as Tabs option lets you filter or group your tasks based on various criteria, such as project-based, currently-being-edited-based, and scope-based. The Move menu allows you to move the view to the top, right, left, or bottom depending upon the current orientation of the view. There are options to stretch or squeeze the view of a window to increase / decrease the size of the view window. The keyboard shortcut is Ctrl + Shift + Up / Ctrl + Shift + Down to increase/decrease the size.

There are individual options available for the views. Stay awake to explore customizations of individual view windows, as shown in the following list:

  • Terminal View: More terminal windows can be opened depending on your requirements by clicking on the + symbol provided with the Terminal view. If you feel that you need to close the active terminal window, you can very easily do so by clicking on the - symbol on the left-hand side. The commands available for the underlying operating system work fine in this terminal; for example, Linux users can type Ctrl + D to exit the terminal, and Windows users can type in their favorite command dir in this terminal.

  • TODO View: The special menu options available for this view are listed here:

    • Select Next Tab: This shows the next available view inside the TODO view.

    • Select Previous Tab: This is used to switch back to the previous view.

    • Show List of Tabs: This shows all views. This provides a dropdown to select from the list of available views inside the TODO view, as shown in the following screenshot:

  • Project View: If you are in the Project View window, you again deserve more than the general options available. The options are described here. Stay tuned and read on.

    • Select Next View: Use this option to go to the next view tab.

    • Select Previous View; Use this option to go to the previous view tab.

    • Show List of Views: Use this option to select from the list of available views for this window.

    • Show Members: If you put a tick mark here, you will be able to see the member functions and variables in the file or code.

    • Autoscroll to Source: This option enables a very useful feature. If you select a file here, the same file will be automatically opened in the editor.

    • Autoscroll from Source: This is a feature similar to the immediately preceding option. If you select a file in the editor, the Project view will automatically show the same file selected in the Project view.

    • Sort by Type: This feature, though seemingly trivial, might prove to be very useful in organizing the files and folders in the project currently being worked upon.

    • Folders Always on Top: You can use this feature to let the folders bubble upwards, and the files are automatically shown under the list of folders.

    The following screenshot shows how the Project view looks:

  • Favorites View: This view section provides three special features:

    • Show Members: This feature shows the list of members in the selected favorite

    • Autoscroll from Source: This is similar to the Project view

    • Autoscroll to Source: This is similar to the Project view

    The Favorites view is as shown in the following screenshot:

  • Structure View: All you enthusiastic programmers out there should make a habit of using this feature intensively because this is more of an engineering practice than a PHP principle. You should always keep this feature handy, as it definitely is your savior at those times when you feel lost in your hard-labored project. So check your seatbelt, and get ready for this informative ride:

    • Sort by Visibility: Use this feature to sort your files and folders according to the visibility of the member functions and variables.

    • Sort Alphabetically: Friends, remember that this feature will be useful and helpful only in cases where naming conventions have been followed by the rule book. This feature enables the sorting of member functions and variables alphabetically. A descriptive name for the feature, isn't it?

    • Show Includes: This feature shows the files included or required programmatically through PHP code as well.

    • Show Fields: This feature show the fields in the class/file.

    • Show Constants: This feature shows the constant values in the class/file.

    • Show Inherited: This feature shows those files/classes that have an inheritance relationship as well.

    • Show Toolbar: This feature shows the discussed features in the form of quick access buttons, as shown in the following screenshot:

  • Database View: Most PHP programmers might ask—why do I need to have the Database view in PhpStorm? There should have been something like an SQLStorm for SQL databases.

    The reason is related to usability. SQL inside PhpStorm is added just to make everything accessible under one roof and stop the programmer from switching back and forth between PhpStorm and SQLStorm. The right-click context menu options available for this feature are:

    • Flatten Schemas: This feature show the database schema in a rather flattened way rather than in a tree structure.

    • Group Tables by Type: This feature groups the tables by their type. This helps in searching for a table in the database and enhances the viewing of the tables.

    • Sort Columns: This feature sorts columns by name for the database selected.

    The Database view options are as shown in the following screenshot: