vrana/phpshrink

Remove spaces and comments from PHP code.

dev-main 2025-05-07 06:59 UTC

This package is auto-updated.

Last update: 2025-05-07 06:59:23 UTC


README

Remove spaces and comments from PHP code.

Operations:

  • remove unnecessary whitespace, change necessary whitespace to \n
  • strip comments, preserve only the first doc-comment
  • minify variables, e.g. in function f($long) { return $long; } (incompatible with $GLOBALS and named arguments)
  • remove extra {}, e.g. in if (true) { oneCommand(); }
  • remove ?><?php and empty <?php ?>
  • change ?>HTML<?php to echo 'HTML'
  • join consecutive echo, e.g. in echo 'a'; echo 'b';
  • strip public visibility or change it to var

Demo: https://vrana.github.io/PhpShrink/

The main user is Adminer.