https://github.com/jsefton/php-dotenv-parser
Allows you get .env file as array and convert array back to .env file
https://github.com/jsefton/php-dotenv-parser
dotenv dotenv-editor dotenv-helper env environment-variables php
Last synced: 4 months ago
JSON representation
Allows you get .env file as array and convert array back to .env file
- Host: GitHub
- URL: https://github.com/jsefton/php-dotenv-parser
- Owner: jsefton
- License: mit
- Created: 2017-08-07T22:00:57.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-28T17:04:19.000Z (over 8 years ago)
- Last Synced: 2025-10-22T20:55:13.280Z (8 months ago)
- Topics: dotenv, dotenv-editor, dotenv-helper, env, environment-variables, php
- Language: PHP
- Homepage:
- Size: 2.93 KB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
## PHP DotEnv Parser
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:
```bash
composer require jsefton/php-dotenv-parser
```
### Usage
To parse a `.env` file to an array pass in the path like below:
```php
$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:
```php
\Jsefton\DotEnv\Parser::arrayToEnv($array, '/path/to/.env');
```