PHPackages                             nbgrp/env-bundle - 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. nbgrp/env-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

nbgrp/env-bundle
================

The bundle provides a few useful custom Symfony Environment Variable processors

v3.0.0(2y ago)27301[2 PRs](https://github.com/nbgrp/env-bundle/pulls)BSD-3-ClausePHPPHP ^8.2CI passing

Since Jul 14Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/nbgrp/env-bundle)[ Packagist](https://packagist.org/packages/nbgrp/env-bundle)[ RSS](/packages/nbgrp-env-bundle/feed)WikiDiscussions 3.x Synced today

READMEChangelog (10)Dependencies (5)Versions (18)Used By (0)

Symfony Environment Variable Processors
=======================================

[](#symfony-environment-variable-processors)

[![Latest Stable Version](https://camo.githubusercontent.com/0ed81f8bd431272a7ae64875aa8e1a5b57bfd5cdd98c721d6bc94c0004351cd0/687474703a2f2f706f7365722e707567782e6f72672f6e626772702f656e762d62756e646c652f76)](https://packagist.org/packages/nbgrp/env-bundle)[![Latest Unstable Version](https://camo.githubusercontent.com/bbc20b2a45df01c2ff3a0f923c6b54ca382685d9a3eb93509808b8cc006395e6/687474703a2f2f706f7365722e707567782e6f72672f6e626772702f656e762d62756e646c652f762f756e737461626c65)](https://packagist.org/packages/nbgrp/env-bundle)[![Total Downloads](https://camo.githubusercontent.com/6c5bb396fa72643bf697a0700dbfaa1768aa7c6a6a48600fbd797112ba2e4e17/68747470733a2f2f706f7365722e707567782e6f72672f6e626772702f656e762d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/nbgrp/env-bundle)[![License](https://camo.githubusercontent.com/687e4faeea1cd7fbef3bc6c3f3db28ec3cf8e73b85c1699d592f4c00dee27695/68747470733a2f2f706f7365722e707567782e6f72672f6e626772702f656e762d62756e646c652f6c6963656e7365)](https://packagist.org/packages/nbgrp/env-bundle)

[![PHP Version Require](https://camo.githubusercontent.com/d05f09db3ff8c6387322e7f10bc9afefc5eba6ff778be800668be4d22bf84f34/687474703a2f2f706f7365722e707567782e6f72672f6e626772702f656e762d62756e646c652f726571756972652f706870)](https://packagist.org/packages/nbgrp/env-bundle)[![Codecov](https://camo.githubusercontent.com/bffc9b351b456f431f27ebb88e7fa5ee7305304c9b92d7bb7392e222b746c7a5/68747470733a2f2f636f6465636f762e696f2f67682f6e626772702f656e762d62756e646c652f6272616e63682f312e782f67726170682f62616467652e7376673f746f6b656e3d3344365247363658584e)](https://codecov.io/gh/nbgrp/env-bundle)[![Audit](https://github.com/nbgrp/env-bundle/actions/workflows/audit.yml/badge.svg)](https://github.com/nbgrp/env-bundle/actions/workflows/audit.yml)

[![SymfonyInsight](https://camo.githubusercontent.com/1984a977621abee652c2b9e0d2549f0f58ef1012106e83bf4eb2769458dad92a/68747470733a2f2f696e73696768742e73796d666f6e792e636f6d2f70726f6a656374732f61643036656338652d333533392d346233632d613562622d3632313266366638343265342f736d616c6c2e737667)](https://insight.symfony.com/projects/ad06ec8e-3539-4b3c-a5bb-6212f6f842e4)

Overview
--------

[](#overview)

The bundle provides a few useful custom Symfony Environment Variable processors:

- [Array Cast](#arraycastenvvarprocessor) processor for array values type casting.
- [CSV](#csvenvvarprocessor) processor with customizable delimiter.

Installation / Configuration
----------------------------

[](#installation--configuration)

```
composer require nbgrp/env-bundle

```

Enable the bundle in `config/bundles.php`:

```
return [
    // ...
    NbGroup\Symfony\NbgroupEnvBundle::class => ['all' => true],
];
```

All Environment Variable processors disabled by default. You should enable the required processors explicitly through the bundle config.

YAML config example:

```
# config/packages/nbgroup_env.yaml
nbgroup_env:
    array_cast: true  #  enable Array Cast processor
    csv:              #  enable CSV processor
        dot: '.'      #  csv-dot will parse env value into array with "." as a separator
        colon: ':'    #  csv-colon will parse env value into array with ":" as a separator
```

PHP config example (for Symfony 5+):

```
// config/packages/nbgroup_env.php
return static function (Symfony\Config\NbgroupEnvConfig $config): void {
    $config->arrayCast()
        ->enabled(true)
    ;

    $config->csv()
        ->enabled(true)
        ->delimiter('dot', '.')
        ->delimiter('colon', ':')
    ;
};
```

Processors
----------

[](#processors)

### `ArrayCastEnvVarProcessor`

[](#arraycastenvvarprocessor)

Performs type casting of the env value to the one of the supported types:

- bool
- int
- float
- string

> nb: If the csv value is not an array it will be casted to an array.

**Example:**

```
# config/services.yaml
parameters:
    env(CSV_BOOL_ENV): '1,0,no,"true"'
    env(CSV_INT_ENV): '1,"2","3"'
    env(JSON_FLOAT_ENV): '{"key1": 1.1,"key2": "2.2"}'
    env(JSON_STRING_ENV): '["foo", "foo \"bar\"", ""]'
...
    bools:   '%env(bool-array:csv:CSV_BOOL_ENV)%'        #  will contains [true, false, false, true]
    ints:    '%env(int-array:csv:CSV_INT_ENV)%'          #  will contains [1, 2, 3]
    floats:  '%env(float-array:json:JSON_FLOAT_ENV)%'    #  will contains ['key1' => 1.1, 'key2' => 2.2]
    strings: '%env(string-array:json:JSON_STRING_ENV)%'  #  will contains ['foo', 'foo "bar"', '']
```

### `CsvEnvVarProcessor`

[](#csvenvvarprocessor)

Parses the env value into array. Unlike build-in `csv` processor, this one supports customization of the delimiter.

To use the CSV processor it should be configured: see [config example](#installation--configuration)how to specify available delimiters (and so env prefixes).

> nb: Do not use backslash `\` for escaping double quote `"` enclosure character (on PHP ^7.4 it will not work). For escape `"` just write it twice.

**Example:**

```
# config/packages/nbgroup_env.yaml
nbgroup_env:
    csv:
        semi: ';'

# config/services.yaml
parameters:
    env(CSV_SEMICOLON_ENV): 'Alice;alice@mail.me'
...
    person: '%env(csv-semi:CSV_SEMICOLON_ENV)%'  #  will contains ['Alice', 'alice@mail.me']
```

###  Health Score

39

—

LowBetter than 87% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 92.8% 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 ~93 days

Recently: every ~147 days

Total

16

Last Release

310d ago

Major Versions

v1.2.0 → v2.1.02022-02-26

v1.2.1 → v2.1.12023-10-04

v1.2.2 → v2.1.22023-10-04

1.x-dev → 2.x-dev2023-10-28

2.x-dev → v3.0.02024-01-05

PHP version history (3 changes)v1.0PHP ^7.1 || ^8.0

v2.0.0PHP ^7.2 || ^8.0

v3.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/1bf60f0c8879751ddfdc9fbc700397b18e6bf15cbccedc811039da123e63a012?d=identicon)[Zmey](/maintainers/Zmey)

---

Top Contributors

[![a-menshchikov](https://avatars.githubusercontent.com/u/2580489?v=4)](https://github.com/a-menshchikov "a-menshchikov (64 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")

---

Tags

symfony-bundlesymfonybundledependency-injectionenvironment-variable-processorenv-var-processor

### Embed Badge

![Health badge](/badges/nbgrp-env-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/nbgrp-env-bundle/health.svg)](https://phpackages.com/packages/nbgrp-env-bundle)
```

###  Alternatives

[pentatrion/vite-bundle

Vite integration for your Symfony app

2734.8M10](/packages/pentatrion-vite-bundle)[async-aws/async-aws-bundle

Configure all your AsyncAws services and enjoy the autowire greatness.

243.4M2](/packages/async-aws-async-aws-bundle)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6041.6k1](/packages/spomky-labs-pwa-bundle)[bornfreee/tactician-domain-events-bundle

Bundle to integrate Tactician Domain Events library with Symfony project

10138.4k](/packages/bornfreee-tactician-domain-events-bundle)

PHPackages © 2026

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