https://github.com/phpowermove/php-code-formatter
A code formatting library for php
https://github.com/phpowermove/php-code-formatter
Last synced: about 1 year ago
JSON representation
A code formatting library for php
- Host: GitHub
- URL: https://github.com/phpowermove/php-code-formatter
- Owner: phpowermove
- License: mit
- Created: 2014-05-21T12:21:12.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2024-08-05T16:30:46.000Z (almost 2 years ago)
- Last Synced: 2025-03-26T20:21:33.491Z (over 1 year ago)
- Language: PHP
- Size: 106 KB
- Stars: 29
- Watchers: 7
- Forks: 12
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP Code Formatter
[](https://packagist.org/packages/gossi/php-code-formatter)
[](https://packagist.org/packages/gossi/php-code-formatter)
[](https://packagist.org/packages/gossi/php-code-formatter)
[](https://travis-ci.org/gossi/php-code-formatter)
[](https://scrutinizer-ci.com/g/gossi/php-code-formatter)
[](https://scrutinizer-ci.com/g/gossi/php-code-formatter)
A library for formatting php code.
## Features
- Whitespace
- New lines
- Indentation (on curly braces only)
- Blanks (partial support)
-> [Wishlist](https://github.com/gossi/php-code-formatter/labels/feature-request)
## Getting started
### Installation
Via composer:
```
composer require gossi/php-code-formatter
```
### From Code
This simple code snippet is all you need:
```php
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](https://github.com/gossi/php-code-formatter/labels/feature-request)). Please help the development, by picking one of the open issues or implement your own rules. See the wiki on [creating your own rules](https://github.com/gossi/php-code-formatter/wiki/creating-your-own-Rules).
Psr-2? Spaces suck, deal with it :p Once [Version 1.0](https://github.com/gossi/php-code-formatter/milestones/Version%201.0) is reached, a psr-2 profile will be shipped.