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

Showing/hiding views


A view, as the name suggests, is a visual area in PhpStorm that enables you, the PHP programmer, to see the various aspects and/or perspectives of the code.

This includes the following:

  • The structure of the code you toiled for

  • Your favorites (or quick view shortcuts)

  • The future plans in the form of a TODO list

  • A bird's-eye view of your entire PHP project

  • How the code changes in the local system and/or the subversioning system

How to do it...

Perform the following steps:

  1. Views in PhpStorm can be shown/hidden via the following keyboard shortcuts and some navigation menu items as well as via some mouse clicks:

    Views

    Shortcuts

    Terminal view

    Alt + F12

    TODO view

    Alt + 6

    Project view

    Alt + 1

    Favorites view

    Alt + 2

    Structure view

    Alt + 7

  2. The best shortcut to access these features is located in the bottom-left corner in PhpStorm and is depicted in the following screenshot:

How it works...

Let us serve the views one at a time so that they can be served hot:

  • The Terminal view: PhpStorm ensures that you don't leave it for any reason whatsoever. In case you wish to do some command-line activity, such as running some shell commands, setting some cron jobs or whatever, there is this command terminal available inside PhpStorm. Please remember the keyboard shortcut Alt + F12.

  • The TODO view: To live the life of a programmer, you need to have multiple core processors to be time-bound; infinite cloud storage volume so that whatever is said to you is recorded somewhere eternally; and 32 GB of RAM so that no context switch pushes the active process out of the memory onto the disk. In short, you need to be Jarvis (Iron Man series). Wake up! You are still a human being with a natural tendency to start dreaming and hence stray from the main topic and forget the main course.

    A TODO view in the PhpStorm IDE is a feature with which you can record your future plans to make changes in the code. This not only helps you (in most cases) to remember your plans but also to search for them later when required. A TODO feature is just a sticky note that has literally occupied all the space on your workbench. Alt + 6 in your sticky note, please.

  • The Project view: A project is analogous to a mechanic's workshop, where great things are made in a not-so-great-looking way. Your project contains all sorts of commented-out code, sample logics, test logics, and failed algorithms, which definitely make you smile at the end of the day when you turn off your computer and go home. In PhpStorm, the Project view is a hierarchical view that shows you the exact hierarchy your code has and what files are located at which node in the tree. In order to show the Project view, use Alt + 1.

  • The Favorites view: A favorite is an item or a list that you need quite frequently, so PhpStorm has provided a feature with which you can very easily look up those items. By default, PhpStorm provides three favorites: the bookmarks in your code, the debugger breakpoints in your code that you might have set, and a list containing other favorite items with the same name as you create your project in PhpStorm. The keyboard shortcut is Alt + 2.

  • The Structure view: What is more relieving to the mind and the soul than to see the entire code in a consolidated format? The PhpStorm IDE provides a Structure view for code in such a way that all the methods are shown in the form of a list. This enables you to have greater control over the members of any class that you created and prevents namespace collision and method duplication. In order to open the Structure view, all you need to remember is the keyboard shortcut Alt + 7.

  • The Database view: Although programming a database is one of the most daunting tasks in the world of programming, PhpStorm eases off this pressure by adding a Database view to the system. It lets you view the database tables, the procedures stored in it, the data stored in it, and a number of general tasks related to databases, which would otherwise have required a dedicated application of its own. The database views can be shown or hidden by simple mouse clicks, as shown in the following recipes. You have the freedom to choose the database server of your choice—it could be a server running on your local system or something running over in the cloud over an IP address and protected by a username and password.