Appearance
ComposerScripts
php
final class Zairakai\LaravelDevTools\Services\ComposerScriptsMerges the Composer scripts of the package (stubs/composer-scripts.json) into the composer.json of a project.
A script that the project does not have is added. A script that the project has with another value is kept, unless $force is given. composer.json keeps the indentation that it has, and is not written when nothing changes.
Source: src/Services/ComposerScripts.php
Methods
merge()
php
public static function merge(string $composerJsonPath, string $stubPath, bool $force = false, callable $beforeWrite = null): array| Parameter | Description |
|---|---|
$beforeWrite | called with the path of composer.json, before it is written over |
Returns array{added: list<string>, updated: list<string>, skipped: list<string>}
Throws RuntimeException when composer.json or the stub is missing or cannot be read