{"id":25171397,"url":"https://github.com/basemax/phpas","last_synced_at":"2025-10-30T22:39:59.838Z","repository":{"id":55925289,"uuid":"188531819","full_name":"BaseMax/PHPAS","owner":"BaseMax","description":"PHP Auto Style: A tool for format and beautify the style of PHP code with my style.","archived":false,"fork":false,"pushed_at":"2021-10-14T21:44:55.000Z","size":183,"stargazers_count":6,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-06T21:46:39.987Z","etag":null,"topics":["beautifier","beautify","beautify-php","formatter","lexer","lexer-parser","parser","parsers","php","php-code-beautify","php-code-cleaner","php-code-formatter","scanner","scanners"],"latest_commit_sha":null,"homepage":"https://www.phpclasses.org/package/11216-PHP-Beautify-PHP-source-code-fixing-its-style.html","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BaseMax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-25T06:56:19.000Z","updated_at":"2023-04-07T11:25:13.000Z","dependencies_parsed_at":"2022-08-15T09:31:30.326Z","dependency_job_id":null,"html_url":"https://github.com/BaseMax/PHPAS","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FPHPAS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FPHPAS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FPHPAS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FPHPAS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaseMax","download_url":"https://codeload.github.com/BaseMax/PHPAS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FPHPAS/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259057365,"owners_count":22799144,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beautifier","beautify","beautify-php","formatter","lexer","lexer-parser","parser","parsers","php","php-code-beautify","php-code-cleaner","php-code-formatter","scanner","scanners"],"created_at":"2025-02-09T09:20:05.087Z","updated_at":"2025-10-30T22:39:54.817Z","avatar_url":"https://github.com/BaseMax.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP AS(Auto Style), PHP Beautifier\n\nA tool for format and beautify the style of PHP code with my style.\n\n## Purpose\n\nWe waste our time to format the code.\nSo it will be a fantastic tool.\n\nAnyway, I hope this tool can help you for format a PHP code easily and fast.\n\n## Story\n\nI developed this tool for myself, not for money, not for a special company.\n\nAlthough it used in some software of a company in India.\n\nAlso it used as PHP snippet formate on [PHPize.online](https://phpize.online)\n\n\n## Main purpose\n\n- Remove extra space after \"for\", \"while\", \"if\" words...\n- Ident cleaning and auto tab for {} and statements...\n- Make clean the comment text\n- ...\n\n### Demo\n\nLeft: Output, Right: Input\n\n![ScreenShot](https://raw.githubusercontent.com/BaseMax/PHPAS/master/screenshot.png)\n\n### Usage\n\n```php\n\u003c?php\n/* Include Class */\ninclude \"PHPAS.php\"\n\n/* Create Class Instance with default options */\n$autoStyle = new AutoStyle();\n\n/* or with optional configuratoin */\n$options = [\n\t'identation' =\u003e '    ' // 4 spaces (default Tab)\n];\n\n$autoStyle = new AutoStyle($options);\n\n/* Format code from file */\nprint $AS-\u003eloadFile(\"test.php\") .\"\\n\";\n\n/* Format code from string */\nprint $AS-\u003eloadString(\"\u003c?php\\nprint 'hi';\\n\") .\"\\n\";\n```\n\n### Class Methods\n\n| Method        \t\t\t| Goal |\n| ------------------------- | ------------- |\n| setOptions($options) \t\t| Change formatter options... \t|\n| loadFile($fileName)  \t\t| Auto Style, format a file and display output... |\n| loadString($codeString)\t| Auto Style, format a string code and display output... |\n\n### Input\n\n```php\n\u003c?php\n/* inline comment */\nfor ($v = 7;$v \u003c= 100 / 10;$v++) {\n$b = $v;\n$x = [];\nfor ($i = 1;$i \u003c= $v;$i++) {\n$x[] = $i;\n}\nfor ($k = 3;$k \u003c= ((floor($v - 1) / 2) + 1);$k++) {\n$r = $k;\nsolve($x, $v, $b, $k, $r);\n}\n}\n```\n\n### Output\n\n```php\n\u003c?php\n/* inline comment */\nfor($v=7;$v\u003c=100/10;$v++) {\n\t$b=$v;\n\t$x=[];\n\tfor($i=1;$i\u003c=$v;$i++) {\n\t\t$x[]=$i;\n\t}\n\n\tfor($k=3;$k\u003c=((floor($v-1)/2)+1);$k++) {\n\t\t$r=$k;\n\t\tsolve($x,$v,$b,$k,$r);\n\t}\n\n}\n```\n\n-------------------\n\n### Input\n\n```php\n\u003c?php\n/*      \t \t \t inline comment */\nfor ($v = 7;$v \u003c= 100 / 10;$v++) { $b = $v; $x = []; for ($i = 1;$i \u003c= $v;$i++) {$x[] = $i;\n}\nfor ($k = 3;$k \u003c= ((floor($v - 1) / 2) + 1);$k++) { $r = $k;\nsolve($x, $v, $b, $k, $r); } }\n$str\n\t=\n\t\t\"hello world!\";\n```\n\n### Output\n\n```php\n\u003c?php\n/* inline comment */\nfor($v = 7;$v \u003c= 100 / 10;$v++) {\n\t$b=$v;\n\t$x=[];\n\tfor($i = 1;$i \u003c= $v;$i++) {\n\t\t$x[]=$i;\n\t}\n\n\tfor($k = 3;$k \u003c= ((floor($v - 1) / 2) + 1);$k++) {\n\t\t$r=$k;\n\t\tsolve($x, $v, $b, $k, $r);\n\t}\n}\n\n$str=\"hello world!\";\n```\n\n## Partnership and development\n\nPlease send issue or pull request if you found a bug or problem.\nFeel free to discuss or send pull...\n\n# License\n\nPHPBeautifier is licensed under the [GNU General Public License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fphpas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemax%2Fphpas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fphpas/lists"}