Skip to content

API

Important

The standalone PHP API was introduced in version 0.4.0. In case you're using a previous version, the API cannot be accessed directly.

UpdateChecker::__construct()

Initializes a new UpdateChecker object for the given Composer installation

Parameter Description
Composer $composer A Composer object which describes the Composer installation to be checked.
OutputBehavior$behavior The constructed OutputBehavior object which describes behavior of user-oriented output.
Options$options Transfer object of all resolved options to be configured for the update check.
$behavior = new OutputBehavior(
    new Style(Style::JSON),
    new Verbosity(Verbosity::VERBOSE),
    $composer->getIO()
);
$options = new Options();
$options->setIncludeDevPackages(false);

new UpdateChecker($composer, $behavior, $options);

UpdateChecker::run()

Runs the update check and returns an UpdateCheckResult object

Example:

$packageBlacklist = [
    'my-vendor/*',
    'roave/security-advisories',
];
$updateChecker->run($packageBlacklist, false);

UpdateChecker::getPackageBlacklist()

Returns packages which were blacklisted (= ignored) during update check

Example:

$blacklistedPackages = $updateChecker->getPackageBlacklist();