PHPackages                             winmillwill/settings\_compile - 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. winmillwill/settings\_compile

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

winmillwill/settings\_compile
=============================

2.1.1(11y ago)826.9k63PHP

Since Feb 3Pushed 10y ago2 watchersCompare

[ Source](https://github.com/winmillwill/settings_compile)[ Packagist](https://packagist.org/packages/winmillwill/settings_compile)[ RSS](/packages/winmillwill-settings-compile/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (3)Versions (11)Used By (3)

Drupal Settings Compile
=======================

[](#drupal-settings-compile)

Motivation
----------

[](#motivation)

You should be able to treat the Drupal configuration represented in settings.php like a simple dictionary that can be serialized in any format that can represent a dictionary, because that's what settings.php actually is. This makes it simple to change the settings without knowing php and even without logging onto the server or making any git commits. You would want to allow this because your application will likely need to exist in several different environments at any arbitrary commit in its history.

An alternate strategy would be to version a settings.php that sets the configuration variables according to Environment Variables fetched with `getenv()`. If you have control over the visibility of Environment Variables to the running php process, then that approach is preferable.

How To
------

[](#how-to)

Install this project with composer.

See `examples/config.yml` and witness the resulting `settings.php` when invoking like this:

```
vendor/bin/settings_compile vendor/winmillwill/settings_compile/examples/config.yml settings.php

```

or you could even do this:

```
vendor/bin/settings_compile https://raw.githubusercontent.com/winmillwill/settings_compile/master/examples/config.yml settings.php

```

The command simply takes a path to a correctly formatted yaml file and the desired path at which to write the resulting settings.php file.

Schema
------

[](#schema)

You can see this stated fairly plainly in [Drupal\\Settings\\Schema](github.com/winmillwill/settings_compile/blob/master/src/Schema.php)but the gist is that you address the globals that are available for modification in settings.php by using the *settings* key, hence your databases hash would start like this:

```
drupal:
...
  settings:
    databases:
      ...
```

and the keys you can set under *settings* is limited to this list:

- `databases`
- `cookie_domain`
- `conf`
- `installed_profile`
- `update_free_access`
- `db_url`
- `db_prefix`
- `drupal_hash_salt`
- `is_https`
- `base_secure_url`
- `base_insecure_url`

You can require your composer autoloader (or any other php file) like this (for 2.0.x):

```
drupal:
...
  include:
    require:
      - $DRUPAL_ROOT/relative/path/to/vendor/autoload.php

```

This works because all values are naively quoted in 2.0.x.

You can specify the full path without aid of the `DRUPAL_ROOT` macro, though that would require whoever edits the yaml file to know the full path to the Drupal application on whatever server.

You can additionally effect ini settings like this:

```
drupal:
...
  ini:
    xdebug.show_exception_trace: 1

```

Starting with 2.1.1, you can disable quoting for your value by prefixing with a `%`, which gives you full access to php:

```
drupal:
...
  include:
    require:
      - %DRUPAL_ROOT . '/relative/path/to/vendor/autoload.php'

```

Similarly, any value starting with a `$` is also naively left untreated.

Alternate Strategy with Environment Variables
---------------------------------------------

[](#alternate-strategy-with-environment-variables)

You can also use the `%` escaping to make a yaml file that can very easily model your config as something that is aware of its environment:

```
drupal:
...
  settings:
    db_url: %getenv('DRUPAL_DB_URL')

```

This makes setting up for your PAAS simple, though it does begin to beg the question as to whether you gain anything by using yaml instead of just versioning the php file and letting another system manage setting the environment variables, as described above in [Motivation](#motivation).

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 88.9% 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 ~36 days

Total

8

Last Release

4233d ago

Major Versions

1.0.4 → 2.0.02014-06-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/3173507b9768a40544504e379117dc7c94f2ec6592bc3a96a6959fb6f1b411b3?d=identicon)[winmillwill](/maintainers/winmillwill)

---

Top Contributors

[![winmillwill](https://avatars.githubusercontent.com/u/873461?v=4)](https://github.com/winmillwill "winmillwill (24 commits)")[![dooug](https://avatars.githubusercontent.com/u/136539?v=4)](https://github.com/dooug "dooug (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/winmillwill-settings-compile/health.svg)

```
[![Health](https://phpackages.com/badges/winmillwill-settings-compile/health.svg)](https://phpackages.com/packages/winmillwill-settings-compile)
```

###  Alternatives

[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)[sineflow/clamav

ClamAV PHP Client for Symfony

10168.5k](/packages/sineflow-clamav)[aeliot/todo-registrar

Register TODOs from source code in issue tracker

153.0k](/packages/aeliot-todo-registrar)

PHPackages © 2026

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