2020-03-02 16:14:20 +08:00
|
|
|
<?php
|
|
|
|
|
|
2022-03-15 18:05:33 +08:00
|
|
|
declare(strict_types=1);
|
2020-03-02 16:14:20 +08:00
|
|
|
|
|
|
|
|
namespace ZM\Utils;
|
|
|
|
|
|
|
|
|
|
class ZMUtil
|
|
|
|
|
{
|
2022-08-13 17:00:29 +08:00
|
|
|
/**
|
|
|
|
|
* 获取 composer.json 并转为数组进行读取使用
|
2022-08-14 18:24:59 +08:00
|
|
|
* @param null|string $path 路径
|
2022-08-13 17:00:29 +08:00
|
|
|
*/
|
2022-08-14 18:24:59 +08:00
|
|
|
public static function getComposerMetadata(?string $path = null): ?array
|
2022-08-13 17:00:29 +08:00
|
|
|
{
|
2022-08-14 18:24:59 +08:00
|
|
|
return json_decode(file_get_contents(($path ?? SOURCE_ROOT_DIR) . '/composer.json'), true);
|
2022-08-13 17:00:29 +08:00
|
|
|
}
|
2020-04-29 15:29:56 +08:00
|
|
|
}
|