Is there any way to minify (or remove comments) in PHP using Visual Studio 2015? I use PHP Tools and when i release php scripts to public server, i would like at least remove all comments from code. I know, is there way to remove comments with content menu, but i wish to have comments in my project and no comments (or minimal and unread code) in publish scripts (some like Bundler & Minifier tool, but for php). Thanks
Minification can be done by removing unnecessary details and eliminating excessive whitespaces, newlines, comments, etc. However, minification reduces the readability of the code. Minification can reduce file size upto 70%. PHP is used to transfer files from development to production environment.
There is basically no point in minifying Php since there is no performance gain in doing so. Although if you insist, there are a few ways to remove comments/whitespaces from source. (and these are not limited to just VisualStudio) -
php -w file.php
=> generates file without comments & whitespaces. Equivalent to php_strip_whitespace() //.* or /.
Hope that helps!
Why aren't you going to use online tool to do it? There are many online tools you can use instead of VS 2015.
Here is one tool for you. http://beta.phpformatter.com/
Hope it helps you and check this answer as solved if it helps you.
Thanks!
You can check Comment Remover tool to remove all the comments from a file with a single button click. It also remove #regions and preserve XML Doc comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With