Files
zhamao-framework/src/ZM/Utils/ZMUtil.php
sunxyw 8ff7da4d23 PHP80 小修 (#187)
* migrate-php80

fix styles
fix static analyse

* fix some bugs
2022-12-19 20:22:47 +08:00

18 lines
403 B
PHP

<?php
declare(strict_types=1);
namespace ZM\Utils;
class ZMUtil
{
/**
* 获取 composer.json 并转为数组进行读取使用
* @param null|string $path 路径
*/
public static function getComposerMetadata(?string $path = null): ?array
{
return json_decode(file_get_contents(($path ?? SOURCE_ROOT_DIR) . '/composer.json'), true, 512, JSON_THROW_ON_ERROR);
}
}