22
33The ` Environment manager ` parse, populates dot environment files to super global $_ ENV files, HTTP request headers.
44
5- It provides to edit environment file.
5+ It provides for editing environment file and manipulate them .
66
77## Installation
88
@@ -12,12 +12,60 @@ It provides to edit environment file.
1212
1313## Prerequisities
1414
15- PHP version requirements: _ PHP >5.3 _
15+ PHP version requirements: _ PHP >7.0 _
1616
1717Use ` use Codervio\Environment\EnvParser ` declaration for parsing dot env files.
1818
1919Use ` use Codervio\Environment\EnvEditor ` declaration for edit and manage dot env file.
2020
21+ ## Usage
22+
23+ Example of fetching env variables and loading into global super variables like ` $_ENV ` , using function ` getenv() ` or directly using instance:
24+
25+ If on a file example.env contains a data:
26+
27+ ``` text
28+ FOO=bar
29+ ```
30+
31+ After loading instance it can be fetching a variable:
32+
33+ ``` php
34+ use Codervio\Envmanager\Envparser;
35+
36+ $envparser = new Envparser;
37+ $envparser->load();
38+ $envparser->run();
39+
40+ $result = $parser->getValue('FOO');
41+ var_dump($result);
42+ ```
43+
44+ Returns a result will automatically detect type of getting env variables:
45+
46+ ``` php
47+ (string) 'bar'
48+ ```
49+
50+ Or get a result using env variables globally:
51+ ``` php
52+ echo apache_getenv('FOO')
53+ echo getenv('FOO')
54+ echo $_ENV('FOO')
55+ ```
56+
57+ ## Returning a result
58+
59+ A result returns in following orders:
60+ - using apache_getenv() if apache service is configured internally to use only Apache environment
61+ - using getenv() that most Unix systems supports
62+ - using PHP native super globals $_ ENV function
63+
64+ It will automatically parse to PHP env functions and super globals so you can access via:
65+ - superglobals functions $_ ENV
66+ - superglobals $_ SERVER variable
67+ - using getenv() if is enabled by system
68+ - using apache_getenv() if is enabled by Apache service
2169
2270## Changelog
2371
@@ -27,11 +75,13 @@ Status of core:
2775| ------------- | :-------------------- |
2876| ` 1.0 ` | Release version |
2977
30- PHP version above ` 5.3 ` .
78+ PHP version above ` 7.0 ` .
3179Quality assurance: Unit tests provided
3280
3381## Table of Contents
3482
3583### EnvParser
3684
85+ * [ ` load() ` ] ( load.md ) - Load an environment .env file or folder with .env files
86+
3787### EnvEditor
0 commit comments