Skip to content

decodelabs/integra

Repository files navigation

Integra

PHP from Packagist Latest Version Total Downloads GitHub Workflow Status PHPStan License

Composer file inspector and front-end

Integra provides inspection tools for your composer.json file and a front end to control composer within your project.

Get news and updates on the DecodeLabs blog.


Installation

Install via Composer:

composer require decodelabs/integra

Usage

Load a context to work from:

use DecodeLabs\Integra\Context;

$context = new Context('path/to/project/');

Or use the Integra Veneer frontage to work from cwd(). Integra will search back up the file tree for the nearest composer.json.

echo Integra::$runDir; // Working directory
echo Integra::$rootDir; // Parent or current dir containing composer.json
echo Integra::$binDir; // Bin dir relative to composer
echo Integra::$composerFile; // Location  of composer.json

Integra::run('update'); // composer update
Integra::runGlobal('update'); // composer global update
Integra::runScript('my-script'); // composer run-script my-script
Integra::runBin('phpstan', '--debug'); // composer exec phpstan -- --debug
Integra::runGlobalBin('phpstan', '--debug'); // composer global exec phpstan -- --debug

if(!Integra::hasPackage('package1')) {
    Integra::install('package1', 'package2'); // composer require package1 package2
}

Integra::installDev('package1', 'package2'); // composer require package1 package2 --dev
Integra::installGlobal('package1', 'package2'); // composer global require package1 package2
Integra::installDevGlobal('package1', 'package2'); // composer global require package1 package2 --dev

Manifest

Access the composer.json manifest:

$manifest = Integra::getLocalManifest();
echo $manifest->getDescription();

foreach($manifest->getRequiredPackages() as $package) {
    echo $package->name;
}

See the Manifest.php class for full data access interface - it maps to the majority of the documented composer config options.

Licensing

Integra is licensed under the MIT License. See LICENSE for the full license text.

About

Composer file inspector and front-end

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages