🌐
GitHub
github.com › cmrcx › phptidy
GitHub - cmrcx/phptidy: This is a little tool for formatting PHP code.
This is a little tool for formatting PHP code. Contribute to cmrcx/phptidy development by creating an account on GitHub.
Starred by 45 users
Forked by 14 users
Languages   PHP 99.5% | PHP 99.5%
🌐
GitHub
github.com › lkrms › pretty-php
GitHub - lkrms/pretty-php: The opinionated PHP code formatter
Previous formatting is ignored, and nothing other than whitespace is changed (see Pragmatism for exceptions) ... PHP 8.4, 8.3, 8.2, 8.1, 8.0 or 7.4 with the standard tokenizer, mbstring and json extensions enabled · pretty-php is distributed as a PHP archive you can download and run: wget -O pretty-php.phar https://github.com/lkrms/pretty-php/releases/latest/download/pretty-php.phar ... wget -O pretty-php.phar https://github.com/lkrms/pretty-php/releases/latest/download/pretty-php.phar wget -O pretty-php.phar.asc https://github.com/lkrms/pretty-php/releases/latest/download/pretty-php.phar.asc gpg --recv-keys 0xE8CC5BC780B581F2 gpg --verify pretty-php.phar.asc pretty-php.phar
Starred by 146 users
Forked by 3 users
Languages   PHP 98.3% | Shell 1.5% | Latte 0.2% | PHP 98.3% | Shell 1.5% | Latte 0.2%
🌐
GitHub
github.com › phpowermove › php-code-formatter
GitHub - phpowermove/php-code-formatter: A code formatting library for php
use gossi\formatter\Formatter; $formatter = new Formatter(); $beautifulCode = $formatter->format($uglyCode); ... php code formatter is not yet finished (see Wishlist). Please help the development, by picking one of the open issues or implement ...
Starred by 31 users
Forked by 11 users
Languages   PHP 100.0% | PHP 100.0%
🌐
GitHub
github.com › mmoreram › php-formatter
GitHub - mmoreram/php-formatter: PHP Formatter is a PHP developer friendly set of tools
$ php-formatter formatter:header:fix src/ --exclude="vendor" In that case, maybe the most used way, you will exclude all vendors from your process. You can use this tool just to test the files will be modified, using option --dry-run ... Any command from this library will never have any impact in your code as long as you have defined this option.
Starred by 169 users
Forked by 17 users
Languages   PHP 100.0% | PHP 100.0%
🌐
GitHub
github.com › kodeclan › phpfmt
GitHub - kodeclan/phpfmt: phpfmt - php code formatter
Default: .phpfmt.ini --constructor=type analyse classes for attributes and generate constructor - camel, snake, golang --dry-run Runs the formatter without atually changing files; returns exit code 1 if changes would have been applied --enable_auto_align disable auto align of ST_EQUAL and T_DOUBLE_ARROW --exclude=pass1,passN,... disable specific passes --help-pass show specific information for one pass --ignore=PATTERN-1,PATTERN-N,... ignore file names whose names contain any PATTERN-N --indent_with_space=SIZE use spaces instead of tabs for indentation.
Starred by 16 users
Forked by 3 users
Languages   PHP 99.4% | PHP 99.4%
🌐
GitHub
github.com › kalimahapps › taqwim
GitHub - kalimahapps/taqwim: VSCode/CLI linter and formatter for PHP · GitHub
VSCode/CLI linter and formatter for PHP. Contribute to kalimahapps/taqwim development by creating an account on GitHub.
Author   kalimahapps
🌐
GitHub
github.com › badoo › phpcf
GitHub - badoo/phpcf: PHP Code Formatter
"strip" . PHP_EOL; echo "Black "."strip".PHP_EOL; // not formatted echo "Arse" . PHP_EOL; $ phpcf check zebra.php zebra.php issues: Expected one space before binary operators (= < > * . etc) on line 3 column 14 Expected one space after binary operators (= < > * .
Starred by 181 users
Forked by 27 users
Languages   PHP 100.0% | PHP 100.0%
🌐
GitHub
github.com › clbustos › PHP_Beautifier
GitHub - clbustos/PHP_Beautifier: This program reformat and beautify PHP 4 and PHP 5 source code files automatically. The program is Open Source and distributed under the terms of PHP Licence. It is written in PHP 5 and has a command line tool.
This program reformat and beautify PHP 4 and PHP 5 source code files automatically. The program is Open Source and distributed under the terms of PHP Licence. It is written in PHP 5 and has a command line tool. - clbustos/PHP_Beautifier
Starred by 108 users
Forked by 45 users
Languages   PHP 97.2% | CSS 1.8% | TeX 0.5% | Shell 0.3% | Ruby 0.2% | Perl 0.0% | PHP 97.2% | CSS 1.8% | TeX 0.5% | Shell 0.3% | Ruby 0.2% | Perl 0.0%
🌐
Reddit
reddit.com › r/phphelp › what is the most common php code formatter?
r/PHPhelp on Reddit: What is the most common PHP code formatter?
August 1, 2024 -

I found three code formatters for PHP.

  • Prettier (With PHP Plugin)

  • PrettyPHP (https://github.com/lkrms/vscode-pretty-php)

  • phpfmt (https://github.com/kokororin/vscode-phpfmt)

I was able to setup Prettier with the PHP plugin but the setup is not ideal since I have to install prettier and the prettier PHP plugin from NPM into the project every single time which is not the case when using Prettier VSCode extension with HTML, JS and CSS. I do like how Prettier has its own configuration .prettierrc files and it allows you to set a standard format for a project you are collaborating with others, however I believe formatting should be done in the IDE such as using a VSCode extension and this is the case with the Prettier extension for HTML, JS and CSS but not for PHP since it requires NPM packages.

The other two do not look popular. Am I missing something? I would like to have a standard format or be able to have an opinionated format setup like Prettier for JS but for PHP.

Find elsewhere
🌐
GitHub
github.com › dcasia › php-code-formatter
GitHub - dcasia/php-code-formatter
An opinionated PHP code formatter, optimized for maximum code readability / consistency / maintainability.
Author   dcasia
🌐
GitHub
github.com › gossi › php-code-formatter › blob › master › README.md
php-code-formatter/README.md at master · phpowermove/php-code...
use gossi\formatter\Formatter; $formatter = new Formatter(); $beautifulCode = $formatter->format($uglyCode); ... php code formatter is not yet finished (see Wishlist). Please help the development, by picking one of the open issues or implement ...
Author   phpowermove
🌐
GitHub
github.com › prettier › plugin-php
GitHub - prettier/plugin-php: Prettier PHP Plugin · GitHub
Formatting of files that contain mixed PHP and HTML is still considered unstable - please see open issues with the tag "inline" for details. If you want to use the plugin in production, we recommend limiting its scope to pure PHP files. <?php array_map(function($arg1,$arg2) use ( $var1, $var2 ) { return $arg1+$arg2/($var+$var2); }, array("complex"=>"code","with"=> function() {return "inconsistent";} ,"formatting"=>"is", "hard" => "to", "maintain"=>true));
Starred by 1.8K users
Forked by 139 users
Languages   PHP 67.1% | JavaScript 32.9%
🌐
GitHub
github.com › topics › php-code-formatter
php-code-formatter · GitHub Topics · GitHub
PHP Auto Style: A tool for format and beautify the style of PHP code with my style. php parser formatter scanner beautify beautifier lexer scanners parsers php-code-cleaner beautify-php lexer-parser php-code-formatter php-code-beautify
🌐
GitHub
github.com › vysker › vscode-php-formatter
GitHub - vysker/vscode-php-formatter: Visual Studio Code extension. A wrapper for the Sensiolabs PHP CS Fixer. Analyzes some PHP source code and tries to fix coding standards issues (PSR-1 and PSR-2 compatible).
Visual Studio Code extension. A wrapper for the Sensiolabs PHP CS Fixer. Analyzes some PHP source code and tries to fix coding standards issues (PSR-1 and PSR-2 compatible). - vysker/vscode-php-for...
Starred by 90 users
Forked by 12 users
Languages   TypeScript 89.5% | JavaScript 10.5% | TypeScript 89.5% | JavaScript 10.5%
🌐
GitHub
github.com › dusterio › prettyhp
GitHub - dusterio/prettyhp: PrettyHP is an opinionated PHP code formatter
PrettyHP is an opinionated PHP code formatter. Contribute to dusterio/prettyhp development by creating an account on GitHub.
Author   dusterio
🌐
GitHub
github.com › DennisBecker › php-code-formatter
GitHub - DennisBecker/php-code-formatter: source code formatting tool for PHP
source code formatting tool for PHP. Contribute to DennisBecker/php-code-formatter development by creating an account on GitHub.
Starred by 3 users
Forked by 3 users
Languages   PHP 100.0% | PHP 100.0%
🌐
Jdorn
jdorn.github.io › sql-formatter
SqlFormatter
<?php $sql = "DROP TABLE IF EXISTS ... VALUES (1),(2),(3),(4);', 3 => 'SELECT * FROM MyTable;' ) SqlFormatter will automatically detect when running in CLI mode and will use ASCII shell highlighting instead of HTML....
🌐
GitHub
github.com › SublimeText › PhpBeautifier
GitHub - SublimeText/PhpBeautifier: Pear Php_beautifier plugin for Sublime Text 2
This is a Sublime Text 2 plugin allowing you to format your PHP code. It uses php beautifier. Install php-pear and php-cli with your package manager :
Starred by 66 users
Forked by 17 users
Languages   Python 100.0% | Python 100.0%
🌐
GitHub
github.com › trovit › php-code-formatter-bundle
GitHub - trovit/php-code-formatter-bundle: Symfony bundle which provides a basic system to organize and execute php code formatters.
Get the manager service wherever you want to call the method execute with the bad formatted code as a parameter. It will return the formatted code. ... // src/AppBundle/Controller/DefaultController.php $code = '<?php echo "hola"; ?>'; $this->get('trovit.php_code_formatter.managers.formatter_manager')->execute($code); // This will return /*<?php echo 'hola'; */
Author   trovit