slimphp / Slim-Console

Slim Framework Console
https://slimframework.com
MIT License
28 stars 12 forks source link

Implement config object #13

Closed flangofas closed 4 years ago

flangofas commented 4 years ago

This is the implementation of #6

It can be accessed by the Application or Command Object.

Use cases:

$config = $app->getConfig();
$config = $command->getConfig();

//Default params:
$params = [
    'bootstrapDir'   => 'app',
    'commandsDir'    => 'Application/Commands',
    'indexDir'       => 'public',
    'indexFile'      => 'index.php',
    'rootDir'        => 'Absolute path of the project\'s root directory',
    'sourceDir'      => 'src',
];

//Retrieve value
$config['commandsDir'];
//OR
$config->get('commandsDir');

Additional params can be stored as follows:

$config['newParam'] = 'value';
//OR
$config->set('newParam') = 'value';

Supported formats

l0gicgate commented 4 years ago

@flangofas I created a new draft in #14. I think it's probably an easier starting point since you essentially would have to entirely rewrite this from the reviewers' directions.

Please don't take offense. Thank you for this initial contribution it gave us a good base to see where we wanted to start at least so it wasn't all done for nothing.

flangofas commented 4 years ago

@l0gicgate No offense taken, I agree. The decisions were not made and it wasn't quite clear how it is going to be implemented, I should've asked more questions in the first place.