PHPackages                             danack/configurator - 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. danack/configurator

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

danack/configurator
===================

Generates config files from PHP, JSON and Yaml data files.

1.1.1(4y ago)159.9k2[1 issues](https://github.com/Danack/Configurator/issues)MITPHPPHP ^7.2 || ^8.0CI failing

Since Jun 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Danack/Configurator)[ Packagist](https://packagist.org/packages/danack/configurator)[ RSS](/packages/danack-configurator/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (6)Versions (22)Used By (0)

Configurator
============

[](#configurator)

A few simple tools to manage configuration data sanely. These tools are to hold environment data that can be shared without risk. They are not designed to hold 'secrets' e.g. api/oauth keys.

- Config file generator
- Environment settings generator
- Convert PHP ini files to PHP-FPM format

Philosophy
----------

[](#philosophy)

Environment variables need to be granular controls. Although they can be grouped together as "environments", they need to be configurable on a per-deploy basis without duplicating large blocks of information.

They also need to be stored alongside the application's code so that they can be maintained easily.

This library allows you to do these two things. All environment settings can be stored in a simple way, and then extracted and combined with arbitrary combinations. E.g. using 'centos,dev' as the environment setting uses all the 'centos' environment settings, with the 'dev' settings over-riding any duplicate settings.

Example usage for people who don't like reading instructions
------------------------------------------------------------

[](#example-usage-for-people-who-dont-like-reading-instructions)

If you install Configurator through Composer, the executable files will be in the `vendor/bin` directory and can be run with:

```
# Generate nginx config file for the centos,dev environment
vendor/bin/configurate -p example/config.php example/config_template/nginx.conf.php autogen/nginx.conf "centos,dev"

# Generate a PHP file that contains a function which returns the current application env settings
vendor/bin/genenv -p example/config.php example/envRequired.php autogen/appEnv.php "centos,dev"

# Convert a PHP ini file to be in the PHP-FPM format
vendor/bin/fpmconv autogen/php.ini autogen/php.fpm.ini
```

Config file generator
---------------------

[](#config-file-generator)

This tool allows you to generate config files from PHP based templates and PHP data files that hold all of the settings for the different environments.

Source config template file:

```
