SyncService
API reference › Scaffold › Services › SyncService
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.
Methods
Section titled “Methods”| Method | Description | Defined 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 |
Method details
Section titled “Method details”run()
Section titled “run() ”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): intSynchronizes 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
| Parameter | Type | Description |
|---|---|---|
$context | PHPForge\ | Project to synchronize. |
$out | PHPForge\ | Output sink. |
$dryRun | bool | Whether to print what applying the providers would change instead of writing anything. |
$exitCode | bool | Whether a dry run returns 1 when applying would write a file or record a new entry. |
$force | bool | Whether to overwrite user-modified and adopted replace files, like reapply --force. |
$decorated | bool | Whether 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
RuntimeException: when the lock file cannot be read.