ndybnov-hw03/cnf-read

There is no license information available for the latest version (1.1.0) of this package.

Installs: 60

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/ndybnov-hw03/cnf-read

1.1.0 2023-08-21 21:17 UTC

This package is auto-updated.

Last update: 2025-12-22 02:29:49 UTC


README

describe

Reader Config file, e.g. .env

require

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

setup

composer require ndybnov-hw03/cnf-read

sample using

$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;

Enjoy and to use ))