Download the PHP package codervio/envmanager without Composer
On this page you can find all versions of the php package codervio/envmanager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codervio/envmanager
More information about codervio/envmanager
Files in codervio/envmanager
Package envmanager
Short Description Codervio Environment manager
License MIT
Homepage http://codervio.com
Informations about the package envmanager
Environment manager
The Environment manager
parses, populates dot environment variables from env files to super global $_ENV variable, apache and getenv function.
It supports for checking variables and fetching system only variables.
It provides for editing environment file and manipulate them.
Donations
Due I am working 100% alone without any helps, organizations and any others team I can be satisfy for receiving any amount of payment to improve, develop and continue building on origin idea of framework.
You can pay any amount to PayPal: https://www.paypal.me/codervio?locale.x=en_US
Installation
Prerequisities
PHP version requirements: PHP >7.0
PHP extension: mbstring
Use use Codervio\Environment\EnvParser
declaration for parsing dot env files.
Use use Codervio\Environment\EnvEditor
declaration for edit and manage dot env file.
A [requirements
] - Requirements and auto detect encodings script automatically can check mbstring extension and automatically detects encoding types.
Usage
Example of fetching env variables and loading into global super variables like $_ENV
, using function getenv()
or directly using instance:
If on a file example.env contains a data:
After loading instance it can be fetching a variable:
Returns a result will automatically detect type of getting env variables:
Or get a result using env variables globally:
Returning a result
A result returns in following orders:
- using apache_getenv() if apache service is configured internally to use only Apache environment
- using getenv() that most Unix systems supports
- using PHP native super globals $_ENV function
It will automatically parse to PHP env functions and super globals so you can access via:
- superglobals functions $_ENV
- superglobals $_SERVER variable
- using getenv() if is enabled by system
- using apache_getenv() if is enabled by Apache service
Changelog
Status of core:
Version | State |
---|---|
1.0 |
Release version |
PHP version above 7.0
.
Quality assurance: Unit tests provided
Table of Contents
Envparser
Common env variables
- For loading simple ENV variables use [
example
]
Lists examples env variables
- Lists of examples env variables: [
lists
]
Comments
- Writing comments: [
comments
]
Comments parsing as variable (dev only, not recommeded)
It is possible to parse comments variables such using:
A variable inside comment can be visible
using command:
which returns as array and keeps # mark:
or directly:
will parsing a variable
Parsing apache env variables or unix exports env variables
- Parsing export or setenv variables: [
envexports
]
Get a system only variables
It is possible to fetch all system variables:
- For fetching single variable or just check a variable exists see [
getSystemVars
] and [checkSystemVar()
]. - See validation types for values in environment variables: [
required()
] - To fetch a comment from a file of specific variable use: [
getComment()
]
References
- [
requirements
] - Requirements and auto detect encodings - [
setEncoding()
] - Manually specify encoding - [
getEncoding()
] - Detect encoding type from file - [
checkSuperGlobalsSet()
] - Check if set or get env directive for $_ENV active - [
Envparser()
] - A construct parser constructor - [
load()
] - Load an environment .env file or folder with .env files - [
getComment()
] - Get a comment from a variable of .env file - [
getValue()
] - Get a value from system environment variables and parsing variables - [
getAllValues()
] - Returns parsed environment variables internally as array - [
getSystemVars()
] - Fetch all or one system variables - [
checkSystemVar()
]- Returns boolean if system variables exists - [
setStrictBool()
] - Parse value to boolen on non-standard values such as 'y/n' or '1/0' - [
required()
] - Instance of variable validator and variable validators
EnvEditor
- [
Enveditor
] - Instance environment for creating environment file - [
Help
] - Common helps and issues in a code