|Last Updated|| ||Ratings|| ||Unique User Downloads|| ||Download Rankings|
|2022-12-30 (11 months ago) ||Not yet rated by the users||Total: 59 ||All time: 10,399 This week: 137|
This package can help to configure objects with option arrays.
It provides a resolver class that can take the names of a set of options and default values that will be assumed when an option value is missing.
The resolver class can also process an array to extract option values or use default values for missing options.
The OptionsResolver component helps you configure objects with option arrays.
|Many classes need to be configured using options provided by the developers in the code that calls the classes' functions.
One way to pass options values is to use arrays with the names and the values of the options that will be changed.
This package simplifies the processing of options arrays that are passed to classes by extracting the values from arrays or default values defined within the class.
* Copyright (c) 2022.
* The OptionsResolver component helps you configure objects with option arrays. It supports default values, option constraints and lazy options.
$database = new Database([
'dbname' => 'app',
// Uncaught InvalidArgumentException: The required option "username" is missing.
// $database = new Database([
// 'host' => 'localhost',
// 'dbname' => 'app',
// 'username' => 'root',
// 'password' => 'root',
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.