PHPackages                             nixiware/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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. nixiware/config

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

nixiware/config
===============

Configuration helper for containerized applications

1.3.1(7y ago)068MITPHPPHP &gt;=5.3.0

Since Sep 6Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Nixiware/config)[ Packagist](https://packagist.org/packages/nixiware/config)[ RSS](/packages/nixiware-config/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (4)Used By (0)

Config
======

[](#config)

Introduction
------------

[](#introduction)

When running PHP applications using orchestration systems (like Docker Swarm / Kubernetes) a lot of configuration is done using environment variables.

While PHP comes with `getenv()` for reading environmnet variables, a lot of time it proves limited when dealing with [secrets](https://docs.docker.com/engine/swarm/secrets/) (reading values from files) or explicitly casting the values to a certain type.

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

[](#requirements)

- PHP 5.3

Usage
-----

[](#usage)

1. Import package namespace `use Nixiware\Config\EnvVar;`
2. Import environment variables using the static method `get($name, $required, $default, $explicitCastType)`

- `$name` - name of the environmnet variable
- `$required` - sets the variable as required / optional for the execution
- `$default` - default value to return if environment variable is not set
- `$explicitCastType` - explicitly cast the returned value to a type

**EnvVar** will first look for an environment variable with the suffix `_FILE`, and if a file path is specified, it will load the contents of that file.

If a variable is specified as required and no default value is provided, a `Nixiware\Config\Exception` will be thrown.

Examples
--------

[](#examples)

- Reading a variable named `DB_HOST`, set as not required with a default value of `127.0.0.1`

```
EnvVar::get('DB_HOST', false, '127.0.0.1');

```

- Reading a variable named `REST_API_ENABLED`, set as required with no default value, and casted as a boolean.

```
EnvVar::get('REST_API_ENABLED', true, null, EnvVar::TypeBool);

```

- Reading a variable from a file, named `DB_PASSWORD`, set as required with no default value.

```
EnvVar::get('DB_PASSWORD', true);

```

Path for the file will be specified using the environment variable `DB_PASSWORD_FILE`. The variable with the suffix `_FILE` is automatically read to allow more flexibility in configuring your application, without requiring to modify the actual configuration files.

Testing
-------

[](#testing)

Giving the fact that the package is designed to help with Docker / Kubernetes deployments, the unit tests must be ran inside a Docker container.

1. Open `docker/` directory and run `bash deployment-start.sh` to start the container
2. Connect to container (similar to SSH) by running `bash container-ssh.sh`
3. Run the install script `bash install.sh` *(inside the container)*
4. Run the tests script `bash run-tests.sh` *(inside the container)*

For cleanup simply run `bash deployment-stop.sh` after exiting the container.

License
-------

[](#license)

Config is available under the MIT license. See the LICENSE file for more info.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Total

2

Last Release

2647d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/982c5b4df8b5f6b032639976f908798ecdb200d7150cd4bc3d6121a301a41556?d=identicon)[adrian\_ilie9](/maintainers/adrian_ilie9)

---

Top Contributors

[![adrianilie9](https://avatars.githubusercontent.com/u/4477959?v=4)](https://github.com/adrianilie9 "adrianilie9 (5 commits)")

---

Tags

dockerenvironmnet-variablekubernetesphp

### Embed Badge

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

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

###  Alternatives

[deployer/deployer

Deployment Tool

11.0k25.4M207](/packages/deployer-deployer)[appwrite/server-ce

End to end backend server for frontend and mobile apps.

55.3k84.2k](/packages/appwrite-server-ce)[pragmarx/health

Laravel Server &amp; App Health Monitor and Notifier

2.0k1.0M2](/packages/pragmarx-health)[felixfbecker/language-server-protocol

PHP classes for the Language Server Protocol

22476.7M6](/packages/felixfbecker-language-server-protocol)[heroku/heroku-buildpack-php

Toolkit for starting a PHP application locally, with or without foreman, using the same config for PHP and Apache2/Nginx as on Heroku

8161.3M10](/packages/heroku-heroku-buildpack-php)[tiamo/phpas2

PHPAS2 is a php-based implementation of the EDIINT AS2 standard

4674.7k](/packages/tiamo-phpas2)

PHPackages © 2026

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