ndybnov-hw03/cnf-read

此包最新版本(1.1.0)没有提供许可证信息。

1.1.0 2023-08-21 21:17 UTC

This package is auto-updated.

Last update: 2024-09-21 23:38:02 UTC


README

描述

读取器配置文件,例如 .env

需要

"require": {
        "php": ">=7.4"
    }

设置

composer require ndybnov-hw03/cnf-read

示例使用

$fileConfig = new FileConfig();
$pathToFileConfig = __DIR__;
$fileConfig->setFilePath($pathToFileConfig);
$fileConfig->setFileName($fileNameConfig = '.env');
$pathFull = $fileConfig->getFullPath();
$readerConfig = new ReadConfig($pathFull);
$readerConfig->read();
$arrayConfig = $readerConfig->toArray();
$storage = new Storage();
$storage->fromArray($arrayConfig);
class ConfigKeysDTO {
    public const KEY = 'KEY';
    public const BKEY = 'BKEY';
}
echo $storage->get(ConfigKeysDTO::KEY);
echo PHP_EOL;

echo $storage->get(ConfigKeysDTO::BKEY) ? '+' : '-';
echo PHP_EOL;

享受并使用 ))