PHPackages                             kerrialn/composer-json-parser - 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. kerrialn/composer-json-parser

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

kerrialn/composer-json-parser
=============================

Access your composer.json as an object

2.0.0(1y ago)119MITPHPPHP ^8.2

Since Mar 26Pushed 1y agoCompare

[ Source](https://github.com/Kerrialn/composer-json-parser)[ Packagist](https://packagist.org/packages/kerrialn/composer-json-parser)[ Docs](https://github.com/kerrialn/composer-json-parser)[ RSS](/packages/kerrialn-composer-json-parser/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (4)Used By (0)

Composer Json Parser
====================

[](#composer-json-parser)

A tool that converts your composer.json file to an object and allows you to find any composer data quickly.

### Install

[](#install)

`composer require kerrialn/composer-json-parser`

### Usage

[](#usage)

Basic usage

```
use KerrialNewham\ComposerJsonParser\ComposerJson;

$composer = (new ComposerJson())->getComposer()
// Will find composer.json create a Composer object
```

With composer.json path

```
use KerrialNewham\ComposerJsonParser\ComposerJson;

$composer = (new ComposerJson())
    ->withComposerJsonPath(path: 'composer/json/directory/')
    ->getComposer()
// Will return a Composer object
```

Don't need to load everything, only what you need:

```
    use KerrialNewham\ComposerJsonParser\ComposerJson;

    $composer = (new ComposerJson())
    ->withName()
    ->withRequire()
    ->withAutoload()
    ->getComposer()
    // Will return a Composer object
```

Need to find a specific package?

```
$composer = (new ComposerJson())->withRequire()->getComposer();
$doctrineOrmPackage = $composer->getRequire()->findFirst(fn (int $key, Package $package) =>  $package->getName() == 'php');
```

Need to modify the composer.json?

```
use KerrialNewham\ComposerJsonParser\ComposerJson;
use KerrialNewham\ComposerJsonParser\Model\Autoload;

$autoload = new Autoload(namespace: 'App\\', path: './src');
$composer = (new ComposerJson())->addPsr4Autoload($autoload)
// Will update composer.json with new PSR4 Autoload namespace
```

What about add a package programmatically?

```
use KerrialNewham\ComposerJsonParser\ComposerJson;
use KerrialNewham\ComposerJsonParser\Model\Autoload;

$packageVersion = new PackageVersion(versionString: '^2.0', version: 2.0, versionConstraints: '^');
$composerJsonPackage = new Package(name: 'kerrialn/composer-json-parser', type: PackageTypeEnum::REQUIRE, packageVersion: $packageVersion);

(new ComposerJson())->withComposerJsonPath()->addRequire(package: $composerJsonPackage);
// Will update composer.json with new package.
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance44

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

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 ~170 days

Total

3

Last Release

443d ago

Major Versions

1.1.0 → 2.0.02025-03-01

### Community

Maintainers

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

---

Top Contributors

[![Kerrialn](https://avatars.githubusercontent.com/u/41723430?v=4)](https://github.com/Kerrialn "Kerrialn (45 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisRector

Code StyleECS

### Embed Badge

![Health badge](/badges/kerrialn-composer-json-parser/health.svg)

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

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[hostnet/entity-tracker-component

Provides an event when a Tracked entity changes

16158.1k4](/packages/hostnet-entity-tracker-component)[leapt/core-bundle

Symfony LeaptCoreBundle

2529.1k4](/packages/leapt-core-bundle)[kibatic/datagrid-bundle

Datagrid for Symfony

1418.3k](/packages/kibatic-datagrid-bundle)

PHPackages © 2026

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