How to format file in PhpStorm
#php #ide #phpstorm

How to format file in PhpStorm

If you are habitual of writing a formatted code don’t worry it’s a good habit but when sometimes you get to debug files which are not formatted what so ever. In that case, it’s a headache to get things done in that sort of files.

In this kind of scenario, PhpStorm comes to rescue, Normal indentation of the file can be done only by the following commands.

Ctrl + A (to select complete file)
Ctrl + Alt + I (this will indent the file properly.)

But sometimes we need more than just indentation. To completely format file got for

Ctrl + Shift + Alt + l

This will open a dialogue box, easy to understand. Select as you are pleased and go for it. This will format your file as you wished it was.

Moreover, sometimes a file is full of unused commented code which is there for no use. I tried for searching a plugin or something to remove all that commented code at ones but I guess there isn’t any.

But found a good solution to this problem. You can use search and replace with regular expression with the following regex.

Multi line comment: /\*(\*)?(((?!\*/)[\s\S])+)?\*/
Single line comment: //.*$

And replace them with empty and we are good to go.

If you also got some more tricks down your sleeves feel free to comment.

Most Viewed Posts


Must Read


How to Add Laravel Pint to VS Code Formatter
June 24, 2022

#code-quality #vscode #laravel-pint #laravel

How to Add Laravel Pint to VS Code Formatter

I have been using the unsatisfactory formatters from a long time. All of them have one thing but lack other. Laravel Pint is one who has it all, combining it with vscode is like proving you laravel project a super power.

Reading time: 2 minutes
January 28, 2022

#AppImage #linux

How to Add AppImage Application to Menu in Ubuntu (Linux)

AppImages are the most easiest to run compared.The challenging task is to make the AppImage accessible globally through he system like an installed application (in the menu)

Reading time: less than a minute
March 24, 2021

#express js #node #node js #sequelize #mysql

How to create model association in Sequelize - express JS / Node JS

In the very initial days of my work in Node JS if faced this issue. Though Sequelize provide a great ORM for MySQL but the association within the models is a bit tricky.

Reading time: 2 minutes
December 14, 2021

#database #javascript #sequelize #npx

Sequelize CLI Commands

list of Sequelize CLI commands which comes handy, while working on a project.

Reading time: 1 minute
How to create a progressive web app (PWA) in laravel 5.* and above
July 07, 2019

#functionality #pwa #javascript #laravel

How to create a progressive web app (PWA) in laravel 5.* and above

The progressive web app is the new trend as well as the need for the present time. I hope before getting in the “HOW” part you know what is exactly a PWA

Reading time: 4 minutes
September 14, 2018

#functionality #authentication #cakephp #php

Auto login in CakePHP 3.x

Although the authentication component of CakePHP 3 has made the life of a developer much easier but still there are some functionalities that are still needed to be done manually. One of them is login automatically if the users have checked for 'remember me'.

Reading time: 3 minutes
November 02, 2020

#blog #php #laravel

How to get started with laravel wink for creating a blog

There are a number of options available for purpose of blog creation but if you are a developer non of them are as satisfying as laravel wink.

Reading time: 1 minute
November 15, 2018

#sql injection #php #mysql #security

How to Sanitize Input in PHP

The inputs in Core PHP are venerable to what you call “SQL Injection”, to before putting them to use it’s a mandatory practice to sanitize them

Reading time: 1 minute
December 10, 2020

#cli #deployment #composer #php #laravel

Creating a Deployment script to make the Deployment Easy

Deployment script for laravel project

Reading time: 1 minute
February 20, 2019

#hosting #deployment #cpanel #php

Steps to make your PHP application live in Cpanel (shared hosting)

Making an application live majorly depends on the type of hosting you are having along with the method to access you are provided for that hosting.

Reading time: 1 minute
mohammed-samgan-khan

Hi, I am Samgan, I know the adds are bit annoying but i hope you understand. Talking about me, I excel at solving complex problems involving logic and step by step breakdown of the problem. Besides, to develop complex algorithms, I specialize in problem framing, systems design, and product development strategy. Sometimes I also enjoy public speaking.