bamarni/composition

There is no license information available for the latest version (v1.0.0) of this package.

Maintainers

Package info

github.com/bamarni/composition

pkg:composer/bamarni/composition

Statistics

Installs: 42

Dependents: 0

Suggesters: 0

Stars: 104

Open Issues: 0

v1.0.0 2016-03-18 11:20 UTC

This package is auto-updated.

Last update: 2026-03-06 03:02:12 UTC


README

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

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

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