PHPackages                             arthem/config-file-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. [File &amp; Storage](/categories/file-storage)
4. /
5. arthem/config-file-bundle

ActiveSymfony-bundle[File &amp; Storage](/categories/file-storage)

arthem/config-file-bundle
=========================

Inject files from env vars in your Symfony configuration

0.0.2(1y ago)0992MITPHPPHP ^8.2

Since Apr 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/4rthem/config-file-bundle)[ Packagist](https://packagist.org/packages/arthem/config-file-bundle)[ RSS](/packages/arthem-config-file-bundle/feed)WikiDiscussions main Synced 1mo ago

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

ArthemConfigFileBundle
======================

[](#arthemconfigfilebundle)

Motivations
-----------

[](#motivations)

In Symfony configuration, you can inject file content as parameter using `env(file:FOO)`

But some Symfony bundles expect you to provide file path whereas your infrastructure can only provide env variables. In some Docker deployments, it is really complicated to mount files and it's easier to deal with env.

This bundle generates files in the cache with your env var written in them, allowing you to write templates.

Let's see a Docker case!

```
# docker-compose.yaml
services:
  symfony-app:
    environments:
    - JWT_PRIVATE_KEY
```

The default env var of docker compose can look like:

```
# .env
JWT_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCN/VTNk1Sdr9mg
...
tDMMHT4ch+pSmyyndMSeu+I+pjF5+cour3FrmmzZFzKivzj0EXbcb+LPUQKBgHWA
WRv4Q33WAa3BFKqCZOKhfFY=
-----END PRIVATE KEY-----
"
```

You have a `jwt_provider` bundle that requires a `private_key_file` (yes, a file path!)

```
# config/packages/jwt_provider.yaml
    jwt_provider:
        private_key_file: "I don't have file, just a JWT_PRIVATE_KEY env var"
```

This is where the bundle helps you!

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

[](#installation)

```
composer require arthem/config-file-bundle
```

Usage
-----

[](#usage)

### Inlined configuration

[](#inlined-configuration)

You can directly write the expected content of your file with the following syntax:

```
param_value: |
    &file:

```

example:

```
# config/packages/jwt_provider.yaml
    jwt_provider:
        private_key_file: |
            &file:jwt_private_key.pem
            %env(JWT_PRIVATE_KEY)%
```

this will:

- Generate the file `jwt_private_key-%hash%.pem` in the project cache directory. (`%hash%` refers to the resolved content of the file)
- Compile your configuration into:

```
# config/packages/jwt_provider.yaml
    jwt_provider:
        private_key_file: 'cache/dir/jwt_private_key-c131d7b5c6bd917a83e0cbea6296bf95.pem'
```

### Provisioned configuration

[](#provisioned-configuration)

The other way to generate files is to define them in the bundle extension config:

```
# config/packages/arthem_config_file.yaml
arthem_config_file:
    files:
        service_account:
            extension: json
            content: |
                {
                  "type": "service_account",
                  "project_id": "my-project",
                  "private_key_id": "%env(json_string:SERVICE_ACCOUNT_ID)%",
                  "private_key": "%env(json_string:SERVICE_ACCOUNT_PRIVATE_KEY)%"
                }
        jwt_private_key:
            extension: pem
            content: '%env(JWT_SECRET_KEY)%'
        jwt_public_key:
            extension: pem
            content: '%env(JWT_PUBLIC_KEY)%'
```

Then inject files in your configuration:

```
# config/packages/jwt_provider.yaml
jwt_provider:
    private_key_file: '%arthem_config_file.file.jwt_public_key%'
```

File content
------------

[](#file-content)

### Escaping values

[](#escaping-values)

This bundle also provides its JSON [env var processor](https://symfony.com/doc/current/configuration/env_var_processors.html)

```
{
  "private_key_id": "%env(json_string:SERVICE_ACCOUNT_PRIVATE_KEY)%"
}
```

This processor escapes JSON strings which can be useful for multiline env vars.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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 ~552 days

Total

2

Last Release

574d ago

PHP version history (2 changes)0.0.1PHP ^8.1

0.0.2PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/c83d7d62f8cb81f94914c46dea1a897d48ae9f1ada66d47005df16f2af4b516b?d=identicon)[arthem](/maintainers/arthem)

---

Top Contributors

[![4rthem](https://avatars.githubusercontent.com/u/2180032?v=4)](https://github.com/4rthem "4rthem (2 commits)")

---

Tags

fileenvdocker

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/arthem-config-file-bundle/health.svg)

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

###  Alternatives

[vich/uploader-bundle

Ease file uploads attached to entities

1.9k25.9M116](/packages/vich-uploader-bundle)[knplabs/knp-gaufrette-bundle

Allows to easily use the Gaufrette library in a Symfony project

72528.6M91](/packages/knplabs-knp-gaufrette-bundle)[sonata-project/media-bundle

Symfony SonataMediaBundle

4625.5M71](/packages/sonata-project-media-bundle)[symfony/ux-dropzone

File input dropzones for Symfony Forms

541.5M4](/packages/symfony-ux-dropzone)[tilleuls/ckeditor-sonata-media-bundle

Integrates SonataMediaBundle with CKEditor

53531.4k1](/packages/tilleuls-ckeditor-sonata-media-bundle)

PHPackages © 2026

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