Download the PHP package tiny-blocks/environment-variable without Composer
On this page you can find all versions of the php package tiny-blocks/environment-variable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tiny-blocks/environment-variable
More information about tiny-blocks/environment-variable
Files in tiny-blocks/environment-variable
Package environment-variable
Short Description Provides a simple and flexible solution for managing environment variables, with easy access, type conversions, and validation handling.
License MIT
Homepage https://github.com/tiny-blocks/environment-variable
Informations about the package environment-variable
Environment variable
- Overview
- Installation
- How to use
- License
- Contributing
Overview
Provides a simple and flexible solution for managing environment variables, with easy access, type conversions, and validation handling.
Installation
How to use
Creating an environment variable
To create and work with environment variables, use the from
method to get an instance of the environment variable.
To retrieve an environment variable with the option of providing a default value in case the variable does not exist,
use the fromOrDefault
method.
If the environment variable is not found, the method will return the provided default value instead of throwing an exception.
Conversions
Once you have an instance of the environment variable, you can convert its value into various types.
Convert to string
To convert the environment variable to a string.
Convert to integer
To convert the environment variable to an integer.
Convert to boolean
To convert the environment variable to a boolean.
Check if the environment variable has a value
Checks if the environment variable has a value. Values like false
, 0
, and -1
are valid and non-empty.
License
Environment variable is licensed under MIT.
Contributing
Please follow the contributing guidelines to contribute to the project.