PHPackages                             folded/config - 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. folded/config

ActiveLibrary

folded/config
=============

Configuration utilities for your PHP web app.

v0.1.5(5y ago)015MITPHPPHP &gt;=7.4.0

Since Sep 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/folded-php/config)[ Packagist](https://packagist.org/packages/folded/config)[ RSS](/packages/folded-config/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (6)Versions (7)Used By (0)

folded/config
=============

[](#foldedconfig)

Configuration and environment utilities for your PHP web app.

[![Packagist License](https://camo.githubusercontent.com/4a2122ca7cc98c9ec2b651ac8be8b175946232cd46773c6b4d81bbdb91cc73e2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f666f6c6465642f636f6e666967)](https://github.com/folded-php/config/blob/master/LICENSE) [![Packagist PHP Version Support](https://camo.githubusercontent.com/ba168f8e4e63d340f213a00d1a4d1f589eb34b9d6312626d679aae7f96d76b9d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f666f6c6465642f636f6e666967)](https://github.com/folded-php/config/blob/master/composer.json#L14) [![Packagist Version](https://camo.githubusercontent.com/ef7fa59258959cb90d82a0ce66cfd718f30a9daed3cb657eb6b18f4e57130751/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666f6c6465642f636f6e666967)](https://packagist.org/packages/folded/config) [![Build Status](https://camo.githubusercontent.com/94af846e68b6392c2d21667efd33b9d50bfe0ad786bf0af3a03c15d0d91238f0/68747470733a2f2f7472617669732d63692e636f6d2f666f6c6465642d7068702f636f6e6669672e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/folded-php/config) [![Maintainability](https://camo.githubusercontent.com/c8a230178e48dda942ca3c19ea1a86bbe575d832b1181aef4b8297566e387535/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f30316363363466336363313931316230306533642f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/folded-php/config/maintainability) [![TODOs](https://camo.githubusercontent.com/1b5eb9171d438df65b56c664e7ce9135f9340acf03c647ec657472de43ff23ec/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d68747470733a2f2f6170692e7469636b6769742e636f6d2f62616467653f7265706f3d6769746875622e636f6d2f666f6c6465642d7068702f636f6e666967)](https://www.tickgit.com/browse?repo=github.com/folded-php/config)

Summary
-------

[](#summary)

- [About](#about)
- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Examples](#examples)
- [Version support](#version-support)

About
-----

[](#about)

I created this library to get an easy to setup way to perform configuration/environment value fetch.

Folded is a constellation of packages to help you setting up a web app easily, using ready to plug in packages.

- [folded/action](https://github.com/folded-php/action): A way to organize your controllers for your web app.
- [folded/config](https://github.com/folded-php/config): Configuration and environment utilities for your PHP web app.
- [folded/crypt](https://github.com/folded-php/crypt): Encrypt and decrypt strings for your web app.
- [folded/exception](https://github.com/folded-php/exception): Various kind of exception to throw for your web app.
- [folded/history](https://github.com/folded-php/history): Manipulate the browser history for your web app.
- [folded/http](https://github.com/folded-php/http): HTTP utilities for your web app.
- [folded/orm](https://github.com/folded-php/orm): An ORM for you web app.
- [folded/request](https://github.com/folded-php/request): Request utilities, including a request validator, for your PHP web app.
- [folded/routing](https://github.com/folded-php/routing): Routing functions for your PHP web app.
- [folded/session](https://github.com/folded-php/session): Session functions for your web app.
- [folded/view](https://github.com/folded-php/view): View utilities for your PHP web app.

Features
--------

[](#features)

- Can get configuration or `.env` values (using dot syntax)
- Can check if a configuration or an env value exist
- Eager load the configuration, such as it is only booted when you get a configuration or an env value

Requirements
------------

[](#requirements)

- PHP version &gt;= 7.4.0
- Composer installed

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

[](#installation)

- [1. Install the package](#1-install-the-package)
- [2. Set up the library](#2-set-up-the-library)

### 1. Install the package

[](#1-install-the-package)

In your project root directory, run this command:

```
composer require folded/config
```

### 2. Set up the library

[](#2-set-up-the-library)

Right before getting the config or env values, integrate this script:

```
use function Folded\setConfigFolderPath;
use function Folded\setEnvFolderPath;

setEnvFolderPath(__DIR__);
setConfigFolderPath(__DIR__ . "/config");
```

You don't have to set up both if you only want to use one or the other. However, if you plan to use both, make sure that `setEnvFolderPath()` is called before `setConfigFolderPath()` in order to take advantage of env variables in configurations.

The env folder path is the folder that contains your `.env` file.

Examples
--------

[](#examples)

Since this library uses vlucas/phpdotenv for the env feature, you can learn more on this file format [in the documentation](https://github.com/vlucas/phpdotenv).

- [1. Getting a configuration value](#1-getting-a-configuration-value)
- [2. Getting an env value](#2-getting-an-env-value)
- [3. Checking if a configuration exist](#3-checking-if-a-configuration-exist)
- [4. Check if an env value exist](#4-check-if-an-env-value-exist)
- [5. Get all config variables](#5-get-all-config-variables)

### 1. Getting a configuration value

[](#1-getting-a-configuration-value)

In this example, we will get a configuration value.

```
use function Folded\getConfig;

echo getConfig("app.name");
```

Asuming your configuration file is located at `config/app.php`, and contains:

```
return [
	"name" => "Folded",
];
```

### 2. Getting an env value

[](#2-getting-an-env-value)

In this example, we will get a value stored in the `.env` file.

```
echo Folded\getEnv("APP_NAME");
```

Asuming your `.env` file contains:

```
APP_NAME="Your app name"

```

### 3. Checking if a configuration exist

[](#3-checking-if-a-configuration-exist)

In this example, we will check if a configuration key exist.

```
use function Folded\hasConfig;

if (hasConfig("app.name")) {
	echo "config exist";
} else {
	echo "config don't exist";
}
```

### 4. Check if an env value exist

[](#4-check-if-an-env-value-exist)

In this example, we will check if an env variable exist.

```
use function Folded\hasEnv;

if (hasEnv("APP_NAME")) {
	echo "has env";
} else {
	echo "has not env";
}
```

### 5. Get all config variables

[](#5-get-all-config-variables)

In this example, we will get all the key/values inside the config file `app.php`.

```
use function Folded\getAllConfig;

$app = getAllConfig("app");

echo $app["name"];
```

Version support
---------------

[](#version-support)

7.37.48.0v0.1.0❌✔️❓v0.1.1❌✔️❓v0.1.2❌✔️❓v0.1.3❌✔️❓v0.1.4❌✔️❓v0.1.5❌✔️❓

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

6

Last Release

2053d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15908747?v=4)[Anwar](/maintainers/khalyomede)[@khalyomede](https://github.com/khalyomede)

---

Top Contributors

[![khalyomede](https://avatars.githubusercontent.com/u/15908747?v=4)](https://github.com/khalyomede "khalyomede (39 commits)")

---

Tags

configurationenvironmentphp

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/folded-config/health.svg)

```
[![Health](https://phpackages.com/badges/folded-config/health.svg)](https://phpackages.com/packages/folded-config)
```

###  Alternatives

[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[forme/framework

An MVC framework for WordPress.

175.0k3](/packages/forme-framework)[doppar/framework

The Doppar Framework

366.7k8](/packages/doppar-framework)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
