1 | <?php |
||
7 | final class Composer |
||
8 | { |
||
9 | public static function getAutoloadedFiles($composerJsonPath): array |
||
10 | { |
||
11 | if (! file_exists($composerJsonPath)) { |
||
12 | return []; |
||
13 | } |
||
14 | |||
15 | $basePath = Str::before($composerJsonPath, 'composer.json'); |
||
16 | |||
17 | $composerContents = json_decode(file_get_contents($composerJsonPath), true); |
||
18 | |||
19 | $paths = array_merge( |
||
20 | $composerContents['autoload']['files'] ?? [], |
||
21 | $composerContents['autoload-dev']['files'] ?? [] |
||
22 | ); |
||
23 | |||
24 | return array_map(fn(string $path) => realpath($basePath.$path), $paths); |
||
|
|||
25 | } |
||
26 | } |
||
27 |