PHPackages                             jnbn/composer-json-fixer - 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. jnbn/composer-json-fixer

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

jnbn/composer-json-fixer
========================

A tool for fixing and cleaning up `composer.json` file according to its schema and best practices.

3.0.1(5y ago)127MITPHPPHP ^7.4|^8.0

Since Jun 30Pushed 5y agoCompare

[ Source](https://github.com/jnbn/composer-json-fixer)[ Packagist](https://packagist.org/packages/jnbn/composer-json-fixer)[ RSS](/packages/jnbn-composer-json-fixer/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (14)Versions (12)Used By (0)

composer.json fixer
===================

[](#composerjson-fixer)

[![Latest Stable Version](https://camo.githubusercontent.com/e139946b14d51cdea3dad0a18fc4b41b963f6741458da421e39243ae45df9246/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6e626e2f636f6d706f7365722d6a736f6e2d66697865722e737667)](https://packagist.org/packages/jnbn/composer-json-fixer)[![PHP Version](https://camo.githubusercontent.com/fc116dfb49f4c600fa3a3d813ab790cf7eae4c643d526b3ec746c79e1f7e0958/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545372e312d3838393242462e737667)](https://php.net)[![License](https://camo.githubusercontent.com/062ac842c204bd8588a87a44f90c63927bb335f19766482cdc88f21dc2c38f70/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a6e626e2f636f6d706f7365722d6a736f6e2d66697865722e737667)](https://packagist.org/packages/jnbn/composer-json-fixer)[![Build Status](https://camo.githubusercontent.com/34539f7858d8d7253b52eabc9b8ec4af69af6605922099016dba99eb73a54136/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a6e626e2f636f6d706f7365722d6a736f6e2d66697865722f6d61737465722e737667)](https://travis-ci.org/jnbn/composer-json-fixer)[![Code coverage](https://camo.githubusercontent.com/0e12cb46d9ea2a7d62d6e2811b9e1679105c83c474c68826607af383a2dc9f81/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6769746875622f6a6e626e2f636f6d706f7365722d6a736f6e2d66697865722f6d61737465722e737667)](https://coveralls.io/github/jnbn/composer-json-fixer?branch=master)

A tool for fixing and cleaning up `composer.json` file according to its [schema](https://getcomposer.org/doc/04-schema.md) and best practices.

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

[](#installation)

composer.json fixer can be installed [globally](https://getcomposer.org/doc/03-cli.md#global):

```
composer global require jnbn/composer-json-fixer

```

or as a dependency (e.g. to include into CI process):

```
composer require --dev jnbn/composer-json-fixer

```

Usage
-----

[](#usage)

Run and fix:

```
vendor/bin/composer-json-fixer

```

See diff of potential fixes:

```
vendor/bin/composer-json-fixer --dry-run

```

Upgrade dependencies with `composer require`:

```
vendor/bin/composer-json-fixer --upgrade

```

Fixers
------

[](#fixers)

- **composer keys lowercase** - changes names of properties to lowercase
- **autoload** - fixes paths and sorts `autoload` and `autoload-dev`
- **config** - sorts `config` by key
- **keywords** - sorts `keywords` by value
- **license** - adds `license` if it is missing
- **minimum stability** - removes `minimum-stability` if it has default value ("stable")
- **name** - makes package name lowercase
- **repositories** - sorts `repositories`
- **require** - cleans up versions for `require` and `require-dev`
- **version** - removes `version` if it is present
- **composer keys sorting** - sorts properties according to [the documentation](https://getcomposer.org/doc/04-schema.md)

Example
-------

[](#example)

Before running `composer-json-fixer`:

```
{
    "name": "JohnDoe/FooBar",
    "version": "v1.0.0",
    "type": "library",
    "description": "A library to do something cool",
    "keywords": [
        "cool",
        "awesome stuff"
    ],
    "require-dev": {
        "phpunit/phpunit": "^5.7 | ^6.5"
    },
    "require": {
        "symfony/finder": "^2.7|^3.4|^4",
        "symfony/yaml": ">= 2.7"
    },
    "minimum-stability": "stable",
    "autoload": {
        "psr-4": {
            "FooBar": "src"
        }
    }
}

```

After:

```
{
    "name": "johndoe/foobar",
    "description": "A library to do something cool",
    "type": "library",
    "keywords": [
        "awesome stuff",
        "cool"
    ],
    "license": "proprietary",
    "require": {
        "symfony/finder": "^2.7 || ^3.4 || ^4",
        "symfony/yaml": ">=2.7"
    },
    "require-dev": {
        "phpunit/phpunit": "^5.7 || ^6.5"
    },
    "autoload": {
        "psr-4": {
            "FooBar\\": "src/"
        }
    }
}

```

Exit status
-----------

[](#exit-status)

- `0` - `composer.json` file does not require fixing,
- `1` - `composer.json` file can be, or was fixed,
- `2` - exception was thrown.

Contributing
------------

[](#contributing)

Request a feature or report a bug by creating [issue](https://github.com/jnbn/composer-json-fixer/issues).

Alternatively, fork the repo, develop your changes, regenerate `README.md`:

```
src/Readme/run > README.md

```

make sure all checks pass:

```
composer check

```

and submit a pull request.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 94.1% 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 ~125 days

Recently: every ~271 days

Total

11

Last Release

1984d ago

Major Versions

v1.3.0 → v2.0.02018-06-24

v2.1.0 → 3.0.02020-04-14

PHP version history (4 changes)v1.0.0PHP &gt;=5.6.6

v2.0.0PHP ^7.1

3.0.0PHP ^7.4

3.0.1PHP ^7.4|^8.0

### Community

Maintainers

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

---

Top Contributors

[![kubawerlos](https://avatars.githubusercontent.com/u/9282069?v=4)](https://github.com/kubawerlos "kubawerlos (111 commits)")[![jnbn](https://avatars.githubusercontent.com/u/112425?v=4)](https://github.com/jnbn "jnbn (7 commits)")

---

Tags

cleanercomposerfixerstandardizationcomposerfixer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jnbn-composer-json-fixer/health.svg)

```
[![Health](https://phpackages.com/badges/jnbn-composer-json-fixer/health.svg)](https://phpackages.com/packages/jnbn-composer-json-fixer)
```

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k234.7M20.6k](/packages/friendsofphp-php-cs-fixer)[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.1M568](/packages/symfony-maker-bundle)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)

PHPackages © 2026

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