src/ComposerScripts.php
private static function discoverPackages(string $vendorPath, string $manifestPath): void
    {
        $installedPackages = [];
        if (file_exists($path = $vendorPath . '/composer/installed.json')) {
            $installedPackages = json_decode(file_get_contents($path), true);
        }

        $discoverPackages = [];
        foreach ($installedPackages as $package) {
            if (! empty($package['extra']['chiron'])) {
                $packageInfo = $package['extra']['chiron'];
                $discoverPackages[$package['name']] = $packageInfo;
            }
        }

        if (! is_writable(dirname($manifestPath))) {
            throw new \RuntimeException('The directory "' . dirname($manifestPath) . '" must be present and writable.');
        }

        file_put_contents($manifestPath, '<?php return ' . var_export($discoverPackages, true) . ';');
    }
private static function discoverPackages(string $vendorPath, string $manifestPath): void
    {
        $installedPackages = [];
        if (file_exists($path = $vendorPath . '/composer/installed.json')) {
            $installedPackages = json_decode(file_get_contents($path), true);
        }

        $discoverPackages = [];
        foreach ($installedPackages as $package) {
            if (! empty($package['extra']['chiron'])) {
                $packageInfo = $package['extra']['chiron'];
                $discoverPackages[$package['name']] = $packageInfo;
            }
        }

        if (! is_writable(dirname($manifestPath))) {
            throw new \RuntimeException('The directory "' . dirname($manifestPath) . '" must be present and writable.');
        }

        file_put_contents($manifestPath, '<?php return ' . var_export($discoverPackages, true) . ';');
    }
private static function discoverPackages ( string $ vendorPath , string $ manifestPath ) : void { $ installedPackages = [ ] ; if ( file_exists ( $ path = $ vendorPath . '/composer/installed.json' ) ) { $ installedPackages = json_decode ( file_get_contents ( $ path ) , true ) ; } $ discoverPackages = [ ] ; foreach ( $ installedPackages as $ package ) { if ( ! empty ( $ package [ 'extra' ] [ 'chiron' ] ) ) { $ packageInfo = $ package [ 'extra' ] [ 'chiron' ] ; $ discoverPackages [ $ package [ 'name' ] ] = $ packageInfo ; } } if ( ! is_writable ( dirname ( $ manifestPath ) ) ) { throw new \ RuntimeException ( 'The directory "' . dirname ( $ manifestPath ) . '" must be present and writable.' ) ; } file_put_contents ( $ manifestPath , '<?php return ' . var_export ( $ discoverPackages , true ) . ';' ) ; }
Discover and Write the found packages in a manifest array file to disk.

@param string $manifestPath
@param array  $manifest

@throws \RuntimeException
Discover and Write the found packages in a manifest array file to disk .