PHPackages                             petstack/lite-env - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. petstack/lite-env

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

petstack/lite-env
=================

Minimal and lightweight .env parser for PHP with no dependencies.

2.0.0(8mo ago)14MITPHPPHP &gt;=8.0

Since Jun 1Pushed 8mo agoCompare

[ Source](https://github.com/petstack/lite-env)[ Packagist](https://packagist.org/packages/petstack/lite-env)[ RSS](/packages/petstack-lite-env/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (3)Used By (0)

Lite Env
========

[](#lite-env)

A minimal and lightweight .env file parser for PHP with no dependencies.

Description
-----------

[](#description)

Lite Env is a simple library for loading environment variables from .env files in PHP applications. It's designed to be lightweight and dependency-free, making it ideal for use in other libraries where minimizing dependencies is important.

> **Note:** This is a lightweight library primarily intended for developing other libraries. For production applications, consider using more powerful and feature-rich alternatives like [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv) or [symfony/dotenv](https://github.com/symfony/dotenv).

Features
--------

[](#features)

- Zero dependencies
- Simple and intuitive API
- **Automatic loading** of `.env` and `.env.local` files
- Support for variable interpolation (`${VAR}` or `$VAR` syntax)
- Type conversion (strings, integers, floats, booleans, null)
- Multiline values
- Quoted values (both single and double quotes)
- Inline comments support with proper whitespace handling
- **Multiple file loading** with single method call
- Comprehensive error handling and validation

Installation
------------

[](#installation)

```
composer require petstack/lite-env
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
