basemax / phpas
PHP自动格式化工具:一款使用我的风格格式化和美化PHP代码的工具。
1.1.0
2020-12-02 14:02 UTC
This package is auto-updated.
Last update: 2024-09-15 03:44:46 UTC
README
一款使用我的风格格式化和美化PHP代码的工具。
用途
我们浪费时间去格式化代码。因此,这将是一个极好的工具。
无论如何,我希望这个工具能帮助你轻松快速地格式化PHP代码。
故事
我开发这个工具是为了自己,不是为了金钱,也不是为了特定的公司。
尽管它被用于印度一家公司的某些软件中。
它也被用作PHPize.online上的PHP代码片段格式化。
主要用途
- 移除"for"、"while"、"if"等单词后面的多余空格...
- 标识符清理和自动制表符对{}和语句...
- 使注释文本更干净
- ...
演示
左侧:输出,右侧:输入
用法
<?php /* Include Class */ include "PHPAS.php" /* Create Class Instance with default options */ $autoStyle = new AutoStyle(); /* or with optional configuratoin */ $options = [ 'identation' => ' ' // 4 spaces (default Tab) ]; $autoStyle = new AutoStyle($options); /* Format code from file */ print $AS->loadFile("test.php") ."\n"; /* Format code from string */ print $AS->loadString("<?php\nprint 'hi';\n") ."\n";
类方法
输入
<?php /* inline comment */ for ($v = 7;$v <= 100 / 10;$v++) { $b = $v; $x = []; for ($i = 1;$i <= $v;$i++) { $x[] = $i; } for ($k = 3;$k <= ((floor($v - 1) / 2) + 1);$k++) { $r = $k; solve($x, $v, $b, $k, $r); } }
输出
<?php /* inline comment */ for($v=7;$v<=100/10;$v++) { $b=$v; $x=[]; for($i=1;$i<=$v;$i++) { $x[]=$i; } for($k=3;$k<=((floor($v-1)/2)+1);$k++) { $r=$k; solve($x,$v,$b,$k,$r); } }
输入
<?php /* inline comment */ for ($v = 7;$v <= 100 / 10;$v++) { $b = $v; $x = []; for ($i = 1;$i <= $v;$i++) {$x[] = $i; } for ($k = 3;$k <= ((floor($v - 1) / 2) + 1);$k++) { $r = $k; solve($x, $v, $b, $k, $r); } } $str = "hello world!";
输出
<?php /* inline comment */ for($v = 7;$v <= 100 / 10;$v++) { $b=$v; $x=[]; for($i = 1;$i <= $v;$i++) { $x[]=$i; } for($k = 3;$k <= ((floor($v - 1) / 2) + 1);$k++) { $r=$k; solve($x, $v, $b, $k, $r); } } $str="hello world!";
合作与发展
如果你发现了错误或问题,请发送问题或pull request。随时讨论或发送pull...
许可
PHPBeautifier遵循GNU通用公共许可证。
