PHPackages                             gossi/php-code-formatter - 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. gossi/php-code-formatter

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

gossi/php-code-formatter
========================

A code formatter for php code

3212.1k11[21 issues](https://github.com/phpowermove/php-code-formatter/issues)PHP

Since Jul 2Pushed 1y ago7 watchersCompare

[ Source](https://github.com/phpowermove/php-code-formatter)[ Packagist](https://packagist.org/packages/gossi/php-code-formatter)[ RSS](/packages/gossi-php-code-formatter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Code Formatter
==================

[](#php-code-formatter)

[![License](https://camo.githubusercontent.com/4e46f9ca74faf92881f5f8a1cec5726e371628da6989729cbf738ff9557eddfa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f676f7373692f7068702d636f64652d666f726d61747465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gossi/php-code-formatter)[![Latest Stable Version](https://camo.githubusercontent.com/26daa0e22019b681101a87b4985d920bc7c487d97ff4837be6f419c825cfc1b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676f7373692f7068702d636f64652d666f726d61747465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gossi/php-code-formatter)[![Total Downloads](https://camo.githubusercontent.com/c14ae8d14618347ef30a1b1486fe961a3581e4b041a29025f333535339634432/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676f7373692f7068702d636f64652d666f726d61747465722e7376673f7374796c653d666c61742d73717561726526636f6c6f72423d303037656336)](https://packagist.org/packages/gossi/php-code-formatter)
[![Build Status](https://camo.githubusercontent.com/1b3389f028d2b2a7d6d5e0dafb041321be5feda352d708d34bf1cdd5c0053cb5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f676f7373692f7068702d636f64652d666f726d61747465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/gossi/php-code-formatter)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/bf10d2a39ed5b283fde10a46d24277105bda5649572744ec3ef391b862c5161b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f676f7373692f7068702d636f64652d666f726d61747465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/gossi/php-code-formatter)[![Code Coverage](https://camo.githubusercontent.com/623e74d2e8d7cade3a40f2891aedfc09b28b79c33194384b2cadffd7a6aabbbf/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f676f7373692f7068702d636f64652d666f726d61747465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/gossi/php-code-formatter)

A library for formatting php code.

Features
--------

[](#features)

- Whitespace
- New lines
- Indentation (on curly braces only)
- Blanks (partial support)

-&gt; [Wishlist](https://github.com/gossi/php-code-formatter/labels/feature-request)

Getting started
---------------

[](#getting-started)

### Installation

[](#installation)

Via composer:

```
composer require gossi/php-code-formatter

```

### From Code

[](#from-code)

This simple code snippet is all you need:

```
use gossi\formatter\Formatter;

$formatter = new Formatter();
$beautifulCode = $formatter->format($uglyCode);
```

### From CLI

[](#from-cli)

A bare cli version is available:

```
vendor/bin/phormat path/to/file.php

```

will output the formatted source code to stdout

Development
-----------

[](#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.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance14

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 92.9% 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/0b1ca3beb32834f0f6a4b66d7a695ecc01397aa92e9a97bd0ba5dd8aa14e0c6e?d=identicon)[gossi](/maintainers/gossi)

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

---

Top Contributors

[![gossi](https://avatars.githubusercontent.com/u/283700?v=4)](https://github.com/gossi "gossi (26 commits)")[![edmondscommerce](https://avatars.githubusercontent.com/u/62842?v=4)](https://github.com/edmondscommerce "edmondscommerce (1 commits)")[![szymsza](https://avatars.githubusercontent.com/u/12534237?v=4)](https://github.com/szymsza "szymsza (1 commits)")

### Embed Badge

![Health badge](/badges/gossi-php-code-formatter/health.svg)

```
[![Health](https://phpackages.com/badges/gossi-php-code-formatter/health.svg)](https://phpackages.com/packages/gossi-php-code-formatter)
```

###  Alternatives

[vlucas/phpdotenv

Loads environment variables from `.env` to `getenv()`, `$\_ENV` and `$\_SERVER` automagically.

13.5k602.4M5.4k](/packages/vlucas-phpdotenv)[symfony/polyfill-php73

Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions

2.4k581.8M67](/packages/symfony-polyfill-php73)[laminas/laminas-code

Extensions to the PHP Reflection API, static code scanning, and code generation

1.9k185.4M172](/packages/laminas-laminas-code)[symfony/lock

Creates and manages locks, a mechanism to provide exclusive access to a shared resource

514127.6M459](/packages/symfony-lock)[spatie/enum

PHP Enums

84529.1M68](/packages/spatie-enum)[m6web/tornado

A library for asynchronous programming.

8155.2k](/packages/m6web-tornado)

PHPackages © 2026

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