jsefton / php-dotenv-parser
Allows you get .env file as array and convert array back to .env file
Installs: 6 964
Dependents: 2
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 2
Open Issues: 1
This package is auto-updated.
Last update: 2024-10-18 01:28:50 UTC
README
This easy tool allows you to pass a .env
file and be returned a parsed array.
You can then add or edit values from this array.
This parser also allows you to pass an array and store as a valid .env
file to be used.
Installation
You will need composer to install this package (get composer). Then run:
composer require jsefton/php-dotenv-parser
Usage
To parse a .env
file to an array pass in the path like below:
$env = \Jsefton\DotEnv\Parser::envToArray('/path/to/.env');
To store an array into a .env
file pass the array along with the path to store it:
\Jsefton\DotEnv\Parser::arrayToEnv($array, '/path/to/.env');