gossi/php-code-formatter
A code formatter for php code
Maintainers
dev-master
2022-07-02 16:06 UTC
Requires
- php: >=7.2
- gossi/php-code-profiles: dev-master
- phootwork/collection: ^1.5
- phootwork/tokenizer: ~0
- symfony/config: ^5.0
- symfony/console: ~2|^3|^4
- symfony/event-dispatcher: ~2|^3|^4
- symfony/yaml: ^5.0
Requires (Dev)
- phootwork/php-cs-fixer-config: ~0.1
- phpunit/phpunit: ^5.7
- sami/sami: ^4|^3
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-06-18 05:19:05 UTC
README
👁 License
👁 Latest Stable Version
👁 Total Downloads
👁 Build Status
👁 Scrutinizer Code Quality
👁 Code Coverage
A library for formatting php code.
Features
- Whitespace
- New lines
- Indentation (on curly braces only)
- Blanks (partial support)
-> Wishlist
Getting started
Installation
Via composer:
composer require gossi/php-code-formatter
From Code
This simple code snippet is all you need:
use gossi\formatter\Formatter; $formatter = new Formatter(); $beautifulCode = $formatter->format($uglyCode);
From CLI
A bare cli version is available:
vendor/bin/phormat path/to/file.php
will output the formatted source code to stdout
Development
php code formatter is not yet finished (see Wishlist). Please help the development, by picking one of the open issues or implement your own rules. See the wiki on creating your own rules.
Psr-2? Spaces suck, deal with it :p Once Version 1.0 is reached, a psr-2 profile will be shipped.
