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

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

phpgt/config
============

Manage configuration with ini files and environment variables.

v1.2.0(2mo ago)08.8k—0%1[3 PRs](https://github.com/PhpGt/Config/pulls)4MITPHPPHP &gt;=8.3CI passing

Since Feb 16Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/PhpGt/Config)[ Packagist](https://packagist.org/packages/phpgt/config)[ GitHub Sponsors](https://github.com/sponsors/PhpGt)[ RSS](/packages/phpgt-config/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (21)Used By (4)

Manage configuration with ini files and environment variables.
==============================================================

[](#manage-configuration-with-ini-files-and-environment-variables)

Manage your project configuration by defining defaults, that can be overridden by ini files and environment variables.

Also provides functionality for generating ini files from the CLI.

Documentation:

---

[ ![Build status](https://camo.githubusercontent.com/c7d92d7cd1265d75c856a6550e4842ef4aeefae305cc9edb651265bfe9483a2a/68747470733a2f2f62616467652e7374617475732e7068702e67742f636f6e6669672d6275696c642e737667)](https://github.com/PhpGt/Config/actions)[ ![Code quality](https://camo.githubusercontent.com/364ac3fb1bcabb60f927e79336ee2d4e65665b9b7ae02cbb0ff5cf6b5a97f808/68747470733a2f2f62616467652e7374617475732e7068702e67742f636f6e6669672d7175616c6974792e737667)](https://scrutinizer-ci.com/g/PhpGt/Config)[ ![Code coverage](https://camo.githubusercontent.com/8dc037c116141bacd884cbc4b4ec087d49bfcd01ffcb74767f8c5c5cbfa1f86f/68747470733a2f2f62616467652e7374617475732e7068702e67742f636f6e6669672d636f7665726167652e737667)](https://scrutinizer-ci.com/g/PhpGt/Config)[ ![Current version](https://camo.githubusercontent.com/8dc65666f089cca2e1985339da862330ec2f3e8a584cf58079fef75d8f54c4aa/68747470733a2f2f62616467652e7374617475732e7068702e67742f636f6e6669672d76657273696f6e2e737667)](https://packagist.org/packages/PhpGt/Config)[ ![PHP.Gt/Config documentation](https://camo.githubusercontent.com/32f8d5f1da795695a55afe10573c144606082c5a4f3dab2e517df43017d66b8c/68747470733a2f2f62616467652e7374617475732e7068702e67742f636f6e6669672d646f63732e737667)](http://www.php.gt/config)Example usage - loading project configuration:
----------------------------------------------

[](#example-usage---loading-project-configuration)

A project's configuration can be split across multiple files. The following example shows how a secret can be supplied through the environment, which is used to override the default value defined within config.ini, and also shows how other named config files can be used.

nginx.conf:

```
location ~ \.php$ {
	fastcgi_pass	unix:/var/run/php/php7.1-fpm.sock;
	fastcgi_param	database_password	super-secret-passw0rd;
	include		fastcgi_params;
}

```

config.ini:

```
[app]
namespace = MyApp
debug = true
logging = verbose

[database]
host = db.example.com
schema = local_shop
username = admin
password = admin_pass

[shopapi]
key = jungfnyyguvffubhgvat
secret = guvfvfnybpnyfubcgurerfabguvatsbelbhurer
```

config.dev.ini:

```
[database]
host = localhost
```

example.php:

```
// Load config.ini
$config = new Config("/path/to/project");

// Note that the database password is overriden in the environment (from nginx)
// and the host is overridden by the development ini file.
echo $config->get("database.host");		// localhost
echo $config->get("database.port");		// 6612
echo $config->get("database.password");		// super-secret-passw0rd
```

Example usage - generating configuration files:
-----------------------------------------------

[](#example-usage---generating-configuration-files)

Sometimes it's useful to generate config files on-the-fly, such as from Continuous Integration scripts. Below shows a quick example of how to generate a `config.deploy.ini` file with a few key-values that will override the default.

```
vendor/bin/config-generate deploy "shopapi.key=test-api-key" "database.schema=local_shop_$BRANCH_NAME"

```

The above command will create a `config.deploy.ini` file (note the first argument of "deploy") and provide overrides for two ini keys using dot notation. Note that because this command will be run within a continuous integration setting, we are expecting there to be a $BRANCH\_NAME variable set for us, allowing us to use a schema name containing the current branch.

Proudly sponsored by
====================

[](#proudly-sponsored-by)

[JetBrains Open Source sponsorship program](https://www.jetbrains.com/community/opensource/)

[![JetBrains logo.](https://camo.githubusercontent.com/b5639e7738c6dfae9fe3f3e20175570b7376ce2577a772e09c25c2d4f14bf86e/68747470733a2f2f7265736f75726365732e6a6574627261696e732e636f6d2f73746f726167652f70726f64756374732f636f6d70616e792f6272616e642f6c6f676f732f6a6574627261696e732e737667)](https://www.jetbrains.com/community/opensource/)

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance87

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~707 days

Total

10

Last Release

63d ago

Major Versions

v0.3.2 → v1.0.02019-06-17

PHP version history (6 changes)v0.0.1PHP &gt;=7.0.0

v0.1.0PHP &gt;=7.1.0

v1.0.0PHP &gt;=7.2.0

v1.1.0PHP &gt;=8.0

v1.1.1PHP &gt;=8.2

v1.2.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e42344b91ce4b91ab57875969f67a0a6a48de570a08bc65d673b06b72fd3a3f?d=identicon)[g105b](/maintainers/g105b)

---

Top Contributors

[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (26 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (25 commits)")[![g105b](https://avatars.githubusercontent.com/u/358014?v=4)](https://github.com/g105b "g105b (12 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

configconfigurationconfiguration-filedeploymentenvironment-variablesiniphpgt

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[deployer/deployer

Deployment Tool

11.1k25.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)
