Download the PHP package benconstable/quick-configure without Composer
On this page you can find all versions of the php package benconstable/quick-configure. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download benconstable/quick-configure
More information about benconstable/quick-configure
Files in benconstable/quick-configure
Package quick-configure
Short Description Simple configuration generator for PHP projects
License MIT
Homepage http://github.com/BenConstable/quick-configure
Informations about the package quick-configure
QuickConfigure
QuickConfigure makes the tedious process of setting configuration options in your builds quick and easy (for you and the people using your code!).
Why?
Often frameworks or libraries require you to specify some basic config to get started. This could be setting database details for example, or setting the base URL for an application.
Usually, this involves either modifying a config file that's under version control or manually creating a file (like Laravel's .env files). This is slow and unweildy, and makes automating builds difficult.
QuickConfigure allows you to specify a simple JSON schema from which required config can be generated. No manually creating config files, no dirty work tree, and a simple script that can be incorporated into your build process. Easy!
Installation
QuickConfigure is installed via Composer:
Basic usage
quick-configure.json
QuickConfigure generates config from a quick-configure.json
file. This file
has the format:
Each listed field will be configured and accessible in your app.
Generating config
Generating config is done via the configure
command. Just run:
That's it!
Using config
QuickConfigure provides a simple API for accessing generated config in your application:
Advanced usage
Environments
QuickConfigure allows you easily to configure different environments from the
same quick-configure.json
file.
By default, config will have no environment (otherwise known as the 'global'
environment). To specify an environment, just pass the --env
flag to the
configure
command, like so:
Then, you can access the config in your application like:
Checking config
If you want to check the current config, just run:
and you can of course supply the --env
flag to check environment config:
Dumping config
If you don't want to use the \QuickConfigure\Config
class, you can dump config
to a file to use however you'd like in your application.
For example, to generate a Laravel .env file , you can just run:
This will create a file called .env.development.php
in your current directory.
Alternatively, use the --stdout
option to dump the config straight to STDOUT.
Dump formats
The --format
option lets you specify the format of the dumped file. Currently,
QuickConfigure supports:
php
: A PHP array (unserialized)json
: A JSON object
Further help
QuickConfigure is built on the excellent Symfony Console Component , so you can make use of the built-in help functionality to get further information about the utility:
Developing & Contributing
Please feel free to fork and contribute to this repository, but do please make sure that you:
- Provide tests (using phpspec and/or Behat)
- Ensure you don't break the existing tests
- Comment your code with PHP docblocs, and stick to the coding style. This is PSR-0 and PSR-1 with Laravel's flavour (I prefer the namespace and class declarations)
To execute the tests, run:
I'm currently in the process of finishing off the phpspec tests - they will be done soon.
License
QuickConfigure is open-sourced software licensed under the MIT license.