Skip to content
PHP Ecosystem
Explore

SyncService

API reference › Scaffold › Services › SyncService

final classPHPForge\Scaffold\Services\SyncService
Sourcesrc/Services/SyncService.php

Applies the allowed and installed providers to the project from the command line, with the same rules as a Composer install or update, or previews what applying them would change.

MethodDescriptionDefined by
run()Synchronizes the project with its providers and ends with a summary line; works with auto: false and creates scaffold-lock.json when it is missing.SyncService
public function run(PHPForge\Scaffold\Config\ProjectContext $context, PHPForge\Scaffold\Console\OutputWriter $out, bool $dryRun = false, bool $exitCode = false, bool $force = false, bool $decorated = false): int

Synchronizes the project with its providers and ends with a summary line; works with auto: false and creates scaffold-lock.json when it is missing.

Parameters

ParameterTypeDescription
$contextPHPForge\Scaffold\Config\ProjectContextProject to synchronize.
$outPHPForge\Scaffold\Console\OutputWriterOutput sink.
$dryRunboolWhether to print what applying the providers would change instead of writing anything.
$exitCodeboolWhether a dry run returns 1 when applying would write a file or record a new entry.
$forceboolWhether to overwrite user-modified and adopted replace files, like reapply --force.
$decoratedboolWhether a dry run colors its diffs.

Returns

int: 1 when a provider manifest cannot be loaded, a file fails to apply or the lock cannot be written, or with $dryRun and $exitCode when applying would change something; 0 otherwise.

Throws