smmccabe/accompanist

A PHP API for generating dynamic composer.json files

1.0.0-beta2 2019-04-11 05:19 UTC

This package is auto-updated.

Last update: 2024-11-11 17:46:18 UTC


README

A simple PHP API for generating composer files

Examples

Basic

use Accompanist\Accompanist;

$accompanist = new Accompanist('Sample Composer File');

$accompanist->addRequire('monolog/monolog');
$accompanist->addRequire('guzzlehttp/guzzle', '^6.3');

$composerJSONString = $accompanist->generateJSON();
// or
$accompanist->writeToFile('output/composer.json');

Load from existing

use Accompanist\Accompanist;

$accompanist = new Accompanist('Imported Composer File');

$accompanist->loadFromFile('import/composer.json');