Skip to content
Check your Composer dependencies at runtime.
Branch: master
Clone or download
Latest commit 4230f3e Mar 18, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
.travis.yml
README.md
composer.json update Mar 18, 2016
phpunit.xml.dist

README.md

Composition Build Status

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.

You can’t perform that action at this time.