2amigos / yiinitializr

Library that will help boost your application installation with ease and also to run Yii applications from its bootstrap files on a much cleaner way that the framework currently proposes.
Other
44 stars 17 forks source link

Adding settings customization (#11) #16

Closed Borales closed 10 years ago

Borales commented 11 years ago

@tonydspaniard @Ragazzo With this PR, we can modify yiinitializr-settings. Sample of config can be like the following:

$dirname = dirname(__FILE__);
$app = $dirname . '/../../..';
$root = $app . '/..';

return array(
    'custom' => array(
        'path' => $app . '/config/settings.php',
    ),
    'yii' => array(
        'path' => $app . '/lib/vendor/yiisoft/yii/framework'
    ),
    'yiinitializr' => array(
        'config' => array(
            'console' => $dirname . '/console.php'
        ),
        'app' => array(
            'root' => $root,
            'directories' => array(
                'config' => array(
                    'main' => $app . '/config',
                    'console' => $app . '/config',
                    'test' => $app . '/config'
                ),
                'runtime' => array(
                    $app
                ),
                'assets' => array(
                    $root . '/www'
                )
            ),
            'classes' => array(
                'frontend' => array('\Yii', 'createWebApplication'),
            )
        ),
    )
);

Custom config (sets in custom section) will be merged with the base config. Sample of such config can be like the following:

return array(
    'yiinitializr' => array(
        'app' => array(
            'directories' => array(
                'config' => array(
                    'api' => $root . '/api/config',
                ),
                'runtime' => array(
                    'api' => $root . '/api'
                ),
            ),
            'classes' => array(
                'api' => array('\MyYii', 'apiApplication'),
            )
        )
    )
);
tonydspaniard commented 10 years ago

Thanks!