PHPackages                             nochso/phormat - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nochso/phormat

ActiveApplication[Utility &amp; Helpers](/categories/utility)

nochso/phormat
==============

PHP source formatter with a single style - essentially godoc for PHP

0.1.5(10y ago)47[1 issues](https://github.com/nochso/phormat/issues)MITPHPPHP ^5.6 || ^7.0

Since Apr 16Pushed 10y ago1 watchersCompare

[ Source](https://github.com/nochso/phormat)[ Packagist](https://packagist.org/packages/nochso/phormat)[ RSS](/packages/nochso-phormat/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (9)Versions (8)Used By (0)

nochso/phormat
==============

[](#nochsophormat)

[![write me to read me](https://camo.githubusercontent.com/da4ad341c72b7900782e51de19e52bc7977e9f71296b6b731200f14d5ae25c85/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f77726974656d652d726561646d652d626c75652e737667)](https://github.com/nochso/writeme)[![License](https://camo.githubusercontent.com/99ff4ed54cc107c9237eaeba052c58c50e584f199f615d912f5e7a99d7ba4c5e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e6f6368736f2f70686f726d61742e737667)](https://packagist.org/packages/nochso/phormat)[![Latest tag on Github](https://camo.githubusercontent.com/0e48dc7da35b3fc2616580a96953492bf52193d6b410998853a3d61e5765aaf8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f6e6f6368736f2f70686f726d61742e737667)](https://github.com/nochso/phormat/tags)[![Travis CI build status](https://camo.githubusercontent.com/9cbfe226b1ee7614a4bf3b1b34aa55820b568d806d2a70bf349cebe35c235559/68747470733a2f2f6170692e7472617669732d63692e6f72672f6e6f6368736f2f70686f726d61742e737667)](https://travis-ci.org/nochso/phormat)[![Coverage status](https://camo.githubusercontent.com/f679a6584371ccccc25017f479ba66314a5206f6edba47278ac592eb92d48fcb/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6e6f6368736f2f70686f726d61742f62616467652e737667)](https://coveralls.io/github/nochso/phormat)

Phormat formats PHP source code.

Differences to other [fixers](https://github.com/FriendsOfPHP/PHP-CS-Fixer) or [PSR2](http://www.php-fig.org/psr/psr-2/):

- You can not influence the style, [similar](https://blog.golang.org/go-fmt-your-code)to [gofmt](https://golang.org/cmd/gofmt/).
- Tabs for indentation.
- Opening braces `{` on the same line: `) {`
- No extra whitespacy lines in code or comments.
- Use statements are always sorted.
- Optional re-arranging of class level elements.
- Fast. Check out the [benchmarks](http://nochso.github.io/phormat/benchmark/).

---

- [nochso/phormat](#nochsophormat)
- [Introduction, goals and scope](#introduction-goals-and-scope)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
    - [Command line options](#command-line-options)
- [Contributing](#contributing)
- [Change log](#change-log)
    - [Unreleased](#unreleased)
    - [0.1.5 - 2016-04-23](#015---2016-04-23)
    - [0.1.4 - 2016-04-23](#014---2016-04-23)
- [License](#license)

Introduction, goals and scope
=============================

[](#introduction-goals-and-scope)

Phormat is a pretty printer based on [nikic/php-parser](https://github.com/nikic/PHP-Parser). It **discards** any formatting and prints source code in a **uniform** style. Custom formatting options are out of scope.

The chosen style is personal preference and attempts to keep the line count low while keeping the code readable.

> You're anti-PSR! Why do you hate FIG?

I'm not. I don't. This is **not a replacement, improvement or critique of PSR2**but merely an alternative you're free to ignore.

PSR2 is quite widespread for a reason and has helped lots of projects decide on a common style. However it does not mean everybody loves it personally or that it is a de-facto standard you must adhere to. The questions of *tabs vs. spaces* or *placement of braces*will always be part of a holy war as it comes down to personal preference.

In the end, it's **best for collaboration** if a project has a **well defined**style that is easy for contributors to adhere to. Which is easily possible for both PSR2 and phormat.

See [php-cs-fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) for a great way to adhere to PSR2.

Requirements
============

[](#requirements)

This project is written for and tested with PHP 5.6, 7.0 and HHVM.

Installation
============

[](#installation)

For end-users the PHAR version is preferred. To install it **globally**:

1. Download the PHAR file from the [latest release](https://github.com/nochso/phormat/releases).
2. Make it executable: `chmod +x phormat.phar`
3. Move it somewhere within your `PATH`: `sudo cp phormat.phar /usr/local/bin/phormat`

As **local Composer development** dependency per project:

```
composer require --dev nochso/phormat

```

As **global** Composer dependency:

```
composer global require nochso/phormat

```

Usage
=====

[](#usage)

As a local dependency `php vendor/bin/phormat` or if installed globally just `phormat`.

```
phormat [options]
phormat [options]   ...

```

By default PHP files from the specified paths will be overwritten. See the options below to override this behaviour.

If path is a folder it will be searched recursively for files ending with `*.php`.

Native PHP templates will be skipped to avoid messing up their formatting. Templates are detected by looking for [alternative syntax for control structures](http://php.net/manual/en/control-structures.alternative-syntax.php)like `if (true): .. endif;`

Command line options
--------------------

[](#command-line-options)

```
Arguments

        One or many paths to files or directories.

Options
    -d, --diff
        Preview diff of formatted code. Implies --no-output.

    -s, --summary
        Show a status summary for each file.

    -o, --order
        Change order of class elements:
        constants > properties > methods
        static > abstract > *
        public > protected > private
        __* > has* > is* > get* > set* > add* > remove* > enable* > disable* > *

    -p, --print
        Print full output of formatted code. Implies --no-output.

    -n, --no-output
        Do not overwrite source files.

    -h, --help
        Show this help.

    --version
        Show version information.

    --self-update
        Update phormat to the latest version.

```

Contributing
============

[](#contributing)

Feedback, bug reports and pull requests are always welcome.

Please read the [contributing guide](CONTRIBUTING.md) for instructions.

Change log
==========

[](#change-log)

See [CHANGELOG.md](CHANGELOG.md) for the full history of changes between releases.

\[Unreleased\]
--------------

[](#unreleased)

### Changed

[](#changed)

- Improved line wrapping: Use a soft limit of 100 characters for lines made of `.`, `||` and `&&`.

\[0.1.5\] - 2016-04-23
----------------------

[](#015---2016-04-23)

### Changed

[](#changed-1)

- Allow self-update without public key.

\[0.1.4\] - 2016-04-23
----------------------

[](#014---2016-04-23)

### Added

[](#added)

- Show warnings when xdebug or xdebug-profiling is enabled.

### Changed

[](#changed-2)

- Put closing parenthesis of multiple lines on a new line.
- Use statements are always sorted.
- Separate classes, interfaces and traits.
- Keep use and group-use statements together.

License
=======

[](#license)

This project is released under the MIT license. See [LICENSE.md](LICENSE.md)for the full text.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

6

Last Release

3667d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6887618?v=4)[Marcel Voigt](/maintainers/nochso)[@nochso](https://github.com/nochso)

---

Top Contributors

[![nochso](https://avatars.githubusercontent.com/u/6887618?v=4)](https://github.com/nochso "nochso (157 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nochso-phormat/health.svg)

```
[![Health](https://phpackages.com/badges/nochso-phormat/health.svg)](https://phpackages.com/packages/nochso-phormat)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M560](/packages/symfony-maker-bundle)[roave/backward-compatibility-check

Tool to compare two revisions of a public API to check for BC breaks

5953.3M55](/packages/roave-backward-compatibility-check)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[recca0120/laravel-erd

Laravel ERD automatically generates Entity-Relationship Diagrams from your Laravel models and displays them using Vuerd.

36072.0k](/packages/recca0120-laravel-erd)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)[ondrejmirtes/better-reflection

Better Reflection - an improved code reflection API

136.2M4](/packages/ondrejmirtes-better-reflection)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
