https://github.com/settermjd/dotenv-parser
This is a small package for working with DotEnv files.
https://github.com/settermjd/dotenv-parser
Last synced: about 2 months ago
JSON representation
This is a small package for working with DotEnv files.
- Host: GitHub
- URL: https://github.com/settermjd/dotenv-parser
- Owner: settermjd
- License: other
- Created: 2023-03-06T09:54:49.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-06T10:25:09.000Z (over 3 years ago)
- Last Synced: 2026-01-02T12:36:36.682Z (6 months ago)
- Language: PHP
- Size: 45.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# DotEnv Parser

This is a small package that can parse and work with [dotenv files](https://hexdocs.pm/dotenvy/dotenv-file-format.html).
It's quite new and likely needs quite a bit of work, but it's a start.
## Installation
Install via [Composer](https://getcomposer.org):
```bash
composer require settermjd/dotenv_parser
```
## Usage
There isn't much to the package.
You can see an example of the package's entire functionality below.
```php
$parser = new Parser('path/to/your/dotenv/file');
// Parse and retrieve the contents of the file as an associative array
$contents = $parser->getContents();
// Retrieve the value of the item with the specified key
$parser->getItem("MY_KEY");
// Check if there is an item in the file with the specified key
$parser->hasItem("MY_KEY");
// Add a new item to the file with the specified key and value
$parser->addItem('SIZE', 2);
```