kot13 / bootstrapi

A better framework for building API with PHP. Built using Slim 3, Eloquent, Zend-ACL
88 stars 22 forks source link

Let's use Config component from Symfony #12

Closed sunsingerus closed 6 years ago

sunsingerus commented 7 years ago

SUPPOSITION bootstrapi has configuration files located in config folder and separate setting.php.

PROPOSITION Let's use Config component from Symfony - this would help to unify all configurations and unify approach to config settings. Proposed component - Config

PS. I can implement this

kot13 commented 7 years ago

A special format for configuration should be used only in compiled programming languages (Java, C/C++, Go and etc.) I think, array is best and simple way for php (as in Yii framework for example).

sunsingerus commented 7 years ago

Yes, totally agree that there is no need to use special config files format - PHP arrays are fine. Proposed change is not about changing file format from PHP array to XML or something like this, but about utilizing Symfony Config component, which provides nice options for config handling and verification. The config itself should be kept as PHP array, like this:

<?php

return [
    'database' => [
        'connections' => [
            'default' => [
                'driver'    => 'mysql',
                'host'      => 'localhost',
                'database'  => 'bootstrapi',
                'username'  => 'root',
                'password'  => 'qwerty',
                'charset'   => 'utf8',
                'collation' => 'utf8_unicode_ci',
                'prefix'    => '',
            ],
        ],
    ],
];
kot13 commented 7 years ago

Hm. I never saw use symfony/config with php array. 70% of the component code is not useful now. Is it worth it to use this component only to verification the array? Maybe there are alternatives?

For example: https://docs.zendframework.com/zend-config/ He simple, but he doesn't verificat.