Here, is a list of 3 free online tools to minify PHP files.
I am actually starting here with a contradictory statement; the fact that minifying PHP is of no use. Yes. Unlike other scripting languages (HTML, JavaScript, or CSS), PHP code is generally not transmitted over the web. So minifying or obfuscating PHP doesn’t really help in improving the parsing or execution time of the page on browser. Nor does it speeds up the page load.
However, if you are just messing up with long structural code, it’s always better to compress some functions that are never gonna change or be edited. So here are some free online tools that help you to minify PHP files. These tools eliminate extra things like comments and white spaces from your PHP code to reduce it in size (that may be useful in case you want to transfer files).
Have a look and check out these free PHP Minifiers. Also check out JavaScript minifiers we reviewed earlier.
Tiny PHP:
Tiny PHP is a free web tool that can minify PHP files. It’s a simple and easy to use PHP minifier designed to perform basic minification on PHP code. Tiny PHP accepts a valid function, snippet, or page of PHP and removes all white spaces, comments, and replace variables from that. However, it doesn’t minify class names, function names, or any references related to them.
You can visit Tiny PHP using the link given at the end of this section. The service provides a clean and user-friendly interface containing a text box where you can enter your code. After that, just scroll down to the bottom of the page and hit “Go Baby Go” button. This will quickly minify your PHP code and produce the output within seconds.
Click on the link below to try out Tiny PHP now!
Try here: Click here to check out Tiny PHP.
PHP Minifier:
PHP Minifier is another free online tool to minify PHP files. It’s a simple and reliable app that provides dedicated service for PHP minification. PHP Minifier provide options to remove white spaces, comments, and doc-style comments from your PHP code. Apart from that, you can preserve or eliminate new lines from your PHP file if you want.
PHP Minifier is very easy to use. It offers multiple options for entering PHP code you want to condense. This includes entering the code either by copy-pasting it to the text area, or by directly uploading files from your system. Once this is done, you can simply press the “Do it!” button at the bottom to minify PHP code. PHP Minifier will quickly compress your PHP code and displays the output in an output section along with a “minify another” link, which takes you back to the homepage of PHP Minifier.
Update 2022: This website has been discontinued. Use some other tool from this list.
Compress PHP Template:
Last in the list is Compress PHP Template, a free online service that can compress or minify PHP or HTML templates. It eliminates all unnecessary HTML comments, white spaces, and line breaks from the final HTML code that is being sent to the browser by a PHP script.
Compress PHP Template can compress PHP templates only (containing php classes and public assets like style sheets, images, etc.) and it works with lots of web development services including phpBB, vBulletin, Joomla php templates, WordPress, and many more!
The interface of the app provides a text area where you can paste your PHP template. After entering the template you need to press the “Compress PHP Template” button below the text area. The code will quickly be minified and the compressed PHP template will be shown in an output box just above the input text area. This compressed template will be reduced in size and will make the webpage (containing resultant HTML code) loads faster on the browser.
Click on the link below to try out Compress PHP Template.
Try here: Click here to check out Compress PHP Tempelate.
These were some of the free online PHP minification tools I have come across. If you find something similar to these, do let us know in comments.
Also check out 4 free PHP IDEs for Windows, we reviewed earlier.