yiinitializr
yiinitializr copied to clipboard
Custom application class
In current implementation i can not create my own application with for example class ApiApplication
because of application creation is hardcoded as web/console, i suggest to check the second param of Initializer::create()
, and if it is an array then first element of it must be application class, and second one is config.
Small changes are also needed here:
https://github.com/2amigos/yiinitializr/blob/master/Helpers/Initializer.php#L41
So, overall the end version can be like this in index.php:
$config = array(
'ApiApplication',
'frontend'
);
Yiinitializr\Helpers\Initializer::create('./../', $config, array(
__DIR__ .'/../../common/config/main.php',
__DIR__ .'/../../common/config/env.php',
__DIR__ .'/../../common/config/local.php'
))->run();
@Ragazzo :+1: and also, I have a similar question to @2amigos - is there any possibility to check "settings.php" config from the path "/common/config/settings.php" and merge it to "yiinitializr/config/settings.php" array? I want to generate "runtime" and "assets" folders for my custom section (like "frontend" and "backend"). Or should I change these settings directly to that file?
If you wish to create a new application (there only two ways of doing an app, whether is a cli or a web app) isn't enough?
What you suggest is to provide a flexible way to create your own configuration settings out of Yiinitializr folder right? As the configurations of Yiinitializr are based on console.php
and settings.php
(in its folder).
Could you propose a pull request so I can have a clear idea of what you are suggesting?
@tonydspaniard if your last question was addressed to me - then:
I want to create "sub-app" (like frontend
, backend
, api
etc) and I want to keep /common/lib/vendor/Yiinitializr/config
folder clean from "direct" modifications.
Also, as mentioned @Ragazzo - it will be nice feature to set "app"-class for each sub-app.
So, I'm suggesting to make an optional /common/config/console.php
and /common/config/settings.php
config files, where we could set our directories and base classes for each sub-app.
If you are still interested after my comment - I can try to make a PR for this issue.
Would be really nice to see @Borales thanks!
@tonydspaniard will do