Scaffolder
API reference › Scaffold › Scaffold › Scaffolder
Applies every authorized provider’s files to the project inside a Composer run by converting Composer’s packages
for the Composer-free ScaffoldRunner.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Creates the Composer adapter for a scaffold run. | Scaffolder |
scaffold() | Applies the files of every installed provider listed in allowed-packages and records them in scaffold-lock.json; a later provider overrides an earlier one per destination, and ejected files stay untouched. | Scaffolder |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(PHPForge\Scaffold\Manifest\ManifestLoader $loader, PHPForge\Scaffold\Scaffold\FileApplier $applier, PHPForge\Scaffold\Scaffold\Lock\LockFile $lockFile, PHPForge\Scaffold\Console\OutputWriter $out, PHPForge\Scaffold\Scaffold\ScaffoldSummary $summary)Creates the Composer adapter for a scaffold run.
Parameters
| Parameter | Type | Description |
|---|---|---|
$loader | PHPForge\ | Loads provider manifests into file mappings. |
$applier | FileApplier | Validates and applies each mapping. |
$lockFile | PHPForge\ | Lock file of the project. |
$out | PHPForge\ | Output sink for notices and warnings. |
$summary | ScaffoldSummary | Counters that the runs of this scaffolder update. |
scaffold()
Section titled “scaffold() ”public function scaffold(PHPForge\Scaffold\Config\ProjectConfig $config, Composer\Package\PackageInterface[] $installedPackages, string $projectRoot, string $vendorDir, array<string, string> $installPaths = []): voidApplies the files of every installed provider listed in allowed-packages and records them in
scaffold-lock.json; a later provider overrides an earlier one per destination, and ejected files stay
untouched.
Parameters
| Parameter | Type | Description |
|---|---|---|
$config | PHPForge\ | Consumer settings of the root package. |
$installedPackages | Composer\ | Packages installed in the project. |
$projectRoot | string | Absolute path to the project root. |
$vendorDir | string | Absolute path to the vendor directory, used for providers missing from $installPaths. |
$installPaths | array<string, | Absolute install paths keyed by package name, as resolved by Composer’s InstallationManager. |
Throws
PHPForge\Scaffold\Exception\ScaffoldException: when the manifest of an allowed provider cannot be loaded.RuntimeException: when the lock file cannot be read or written.