PHPackages                             dusterio/prettyhp - 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. dusterio/prettyhp

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

dusterio/prettyhp
=================

PrettyHP is an opinionated PHP code formatter

119[1 PRs](https://github.com/dusterio/prettyhp/pulls)PHPCI failing

Since Jul 25Pushed 3y ago2 watchersCompare

[ Source](https://github.com/dusterio/prettyhp)[ Packagist](https://packagist.org/packages/dusterio/prettyhp)[ RSS](/packages/dusterio-prettyhp/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (7)Used By (0)

prettyhp
========

[](#prettyhp)

[![Logo](https://camo.githubusercontent.com/43e9226b8eb8f93fc23e0814f7c4238ba3ce012f758c04ce6b30bed5aaf50e9f/68747470733a2f2f7777772e6d7973656e6b6f2e636f6d2f696d616765732f70726574747968705f6c6f676f5f3531325f7472616e7370352e706e67)](https://camo.githubusercontent.com/43e9226b8eb8f93fc23e0814f7c4238ba3ce012f758c04ce6b30bed5aaf50e9f/68747470733a2f2f7777772e6d7973656e6b6f2e636f6d2f696d616765732f70726574747968705f6c6f676f5f3531325f7472616e7370352e706e67)

[![Build Status](https://camo.githubusercontent.com/e84337d0ee4ee8f3014e6cabe0c39a03ba1324fb5b07759905a8a46928f85e60/68747470733a2f2f7472617669732d63692e6f72672f647573746572696f2f70726574747968702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dusterio/prettyhp)[![Code Climate](https://camo.githubusercontent.com/ab80ac63f2b4cf4885f8eae5c4c637bf58fa2d523cc02355d4e3e4fe9107e391/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f647573746572696f2f70726574747968702f6261646765732f6770612e737667)](https://codeclimate.com/github/dusterio/prettyhp/badges)[![Latest Stable Version](https://camo.githubusercontent.com/23cca0f365a6b9966e3ac9831a97c4a2c29dc1eabb4a94a425eb7a8ae1ab93e3/68747470733a2f2f706f7365722e707567782e6f72672f647573746572696f2f70726574747968702f762f737461626c65)](https://packagist.org/packages/dusterio/prettyhp)[![Total Downloads](https://camo.githubusercontent.com/26349ef86e8eca734a18407123aac2b98babcaef05dd040c39a9fa99541764cd/68747470733a2f2f706f7365722e707567782e6f72672f647573746572696f2f70726574747968702f646f776e6c6f616473)](https://packagist.org/packages/dusterio/prettyhp)[![License](https://camo.githubusercontent.com/db395b38e7d8edecf190c8dacdf8eff7a570794ae839ea500075f2cf37739c48/68747470733a2f2f706f7365722e707567782e6f72672f647573746572696f2f70726574747968702f6c6963656e7365)](https://packagist.org/packages/dusterio/prettyhp)

PrettyHP is an opinionated PHP code formatter

It removes all original styling and ensures that all outputted code conforms to a consistent style.

PrettyHP will try to comply with PSR as much as possible.

Inspired by JavaScript's [prettier](https://github.com/prettier/prettier)

But why?
--------

[](#but-why)

Your IDE or editor may already have some basic formatting built-in, but:

- At least PhpStorm cannot re-format code automatically before committing to VCS;
- Different team members may have different editors, views and standards;
- At least PhpStorm doesn't really enforce styling, it just does some basic indenting.

Why not use existing PHP code formatters?

### phpfmt

[](#phpfmt)

phpfmt is officially closed, the repo is deleted by the authors.

### php-cs-fixer

[](#php-cs-fixer)

I'm a very experienced developer and Linux user, yet I couldn't get it up and running in 10+ minutes. Something is just wrong about it. Since the tool's verbose mode is not implemented, I couldn't debug it any further.

Installation
------------

[](#installation)

```
$ composer require --dev dusterio/prettyhp
```

We recommend to add a pre-commit Git hook so that any modified PHP files are prettified right before the commit:

```
$ cat .git/hooks/pre-commit

git diff --staged --diff-filter=dx --name-only HEAD | grep ".*\.php$" | xargs -I % sh -c 'vendor/bin/prettyhp format %; git add %'
```

Manual usage
------------

[](#manual-usage)

PrettyHP is meant for PSR 4 compliant files – one file should contain one PHP class.

```
$ vendor/bin/prettyhp [filename]
```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a44ee42fe69a7926153637c0249b0faf83a1a67edd1231f449a74dcf5721c345?d=identicon)[dusterio](/maintainers/dusterio)

---

Top Contributors

[![dusterio](https://avatars.githubusercontent.com/u/11039918?v=4)](https://github.com/dusterio "dusterio (47 commits)")

### Embed Badge

![Health badge](/badges/dusterio-prettyhp/health.svg)

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

PHPackages © 2026

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