Appearance
ComposerJson
php
final class Zairakai\LaravelDevTools\Services\ComposerJsonReads and writes the composer.json of a project, and the scripts in it, with the indentation that the file has.
Source: src/Services/ComposerJson.php
Methods
encode()
php
public static function encode(array $composer, string $original): stringjson_encode indents with 4 spaces: the output is indented as the file was (2 spaces when it cannot be told).
read()
php
public static function read(string $path): arrayReturns array{string, array<string, mixed>} the text of the file, and what it decodes to
Throws RuntimeException when the file is missing or cannot be read
scripts()
php
public static function scripts(array $composer): arrayReturns array<string, mixed>