PHPackages                             bamarni/composition - 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. bamarni/composition

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

bamarni/composition
===================

v1.0.0(10y ago)103424PHPPHP &gt;5.3.0

Since Mar 18Pushed 10y ago7 watchersCompare

[ Source](https://github.com/bamarni/composition)[ Packagist](https://packagist.org/packages/bamarni/composition)[ RSS](/packages/bamarni-composition/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Composition [![Build Status](https://camo.githubusercontent.com/f5a7978fb55a099960eb472f50d7c865bbfed255c0f112f92d552f9ce5fa8fd2/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f636f6d706f736974696f6e2f636f6d706f736974696f6e2e706e67)](https://secure.travis-ci.org/composition/composition)
=========================================================================================================================================================================================================================================================================================================

[](#composition-)

Composition provides a lightweight and generic API, that you can use to check your environment at runtime, instead of manually go checking for regex in constants, classes/functions existence, matching a version against a class constant, ...

It only works when using Composer as package management tool.

Some examples
-------------

[](#some-examples)

A single command to check your PHP environment :

```
if (!\Composition::has('vendor/super-package', '>=2.0') {
    $this->markTestSkipped('The following tests require "SuperPackage" to be at least at 2.0');
}

\Composition::has('php', '5.4.*');
\Composition::has('ext-mongo');
```

Check the platform :

```
if (\Composition::isWindows()) {
// ...
}
```

Note
----

[](#note)

This tool should mostly be used in your unit tests, and not be abused in production.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% 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

Unknown

Total

1

Last Release

3756d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5aaeb479031edf14ed54ebd48015a9146be0f0ed7745adf3efbaf4edb0659bd1?d=identicon)[bamarni](/maintainers/bamarni)

---

Top Contributors

[![bamarni](https://avatars.githubusercontent.com/u/1205386?v=4)](https://github.com/bamarni "bamarni (11 commits)")[![umpirsky](https://avatars.githubusercontent.com/u/208957?v=4)](https://github.com/umpirsky "umpirsky (1 commits)")

### Embed Badge

![Health badge](/badges/bamarni-composition/health.svg)

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

###  Alternatives

[roave/backward-compatibility-check

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

5973.6M94](/packages/roave-backward-compatibility-check)[brianhenryie/strauss

Prefixes dependencies namespaces so they are unique to your plugin

190406.5k30](/packages/brianhenryie-strauss)[dominikb/composer-license-checker

Utility to check for licenses of dependencies and block/allow them.

574.3M12](/packages/dominikb-composer-license-checker)[magento/composer

Magento composer library helps to instantiate Composer application and run composer commands.

317.8M12](/packages/magento-composer)[noerd/noerd

101.3k6](/packages/noerd-noerd)[ec-europa/toolkit

Toolkit packaged for Drupal projects based on Robo.

39250.0k28](/packages/ec-europa-toolkit)

PHPackages © 2026

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