Download the PHP package xety/configurator without Composer
On this page you can find all versions of the php package xety/configurator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xety/configurator
More information about xety/configurator
Files in xety/configurator
Package configurator
Short Description A simple configuration class without dependencies that use the Fluent pattern.
License MIT
Homepage https://github.com/Xety/Configurator
Informations about the package configurator
Configurator
Travis | Coverage | Stable Version | Downloads | PHP | License |
---|---|---|---|---|---|
A simple configuration class without dependencies that use the Fluent pattern.
Requirement
Installation
Usage
The Configurator
class is an abstract class, so you just need to extends
it:
If you want to setup a default configuration for your class, just do the following :
Docs
Methods
Name | Description |
---|---|
setConfig | Set the values to the options array. |
getConfig | Get all the options with their values. |
flushConfig | Flush a list of options from the config array. |
mergeConfig | Merge the values to the options array. |
clearConfig | Clear all options stored. |
setOption | Set a value to the given option. |
getOption | Get an option value. |
hasOption | Check if the option exist. |
flushOption | Flush an option. |
pushOption | Push the listed args to the named option. |
consumeOption | Read then flush an option. |
transientOption | Adds a transient configuration key/value. |
Configurator::setConfig
Description
Set the values to the options array. This function will replace all the configuration options.
Parameters
(array) $values
: The values to push into the config.
Return Values
\Xety\Configurator\Configurator::class
Configurator::getConfig
Description
Get all the options with their values.
Parameters
This function has no parameters.
Return Values
array
Configurator::flushConfig
Description
Flush a list of options from the options array.
Usage:
Parameters
(string) ...$filter
: All the options to remove from the config.
Return Values
\Xety\Configurator\Configurator::class
Configurator::mergeConfig
Description
Merge the values to the options array.
Parameters
(array) $values
: The values to merge in the config.(bool) $invert
: Invert the merge by merging the actual config into the values.
Return Values
\Xety\Configurator\Configurator::class
Configurator::clearConfig
Description
Clear all options stored.
Parameters
This function has no parameters.
Return Values
\Xety\Configurator\Configurator::class
Configurator::setOption
Description
Set a value to the given option.
Usage:
Parameters
(string) $name
: The option name.(mixed) $value
: The option value.
Return Values
\Xety\Configurator\Configurator::class
Configurator::getOption
Description
Get an option value.
Usage:
Parameters
(string) $name
: The option name to to get.
Return Values
mixed
Configurator::hasOption
Description
Check if the option exist.
Parameters
(string) $name
: The option name to check.
Return Values
bool
Configurator::flushOption
Description
Flush an option.
Parameters
(string) $name
: The name of the option to flush.
Return Values
\Xety\Configurator\Configurator::class
Configurator::pushOption
Description
Push the listed args to the named option.
Usage:
Result:
Parameters
(string) $name
: The name of the option.(array) $args
: A list of values to push into the option key.
Return Values
\Xety\Configurator\Configurator::class
Configurator::consumeOption
Description
Read then flush an option. Exemple:
Config:
Usage:
Result:
Parameters
(string) $name
: The name of the option to read then flush.
Return Values
mixed
Configurator::transientOption
Description
Adds a transient configuration key/value.
Usage:
Parameters
(string) $name
: The name of the option.(mixed) $value
: The value to set.
Return Values
\Xety\Configurator\Configurator::class
Contribute
If you want to contribute, please follow this guide.