CodeIgniter Forums
can I override or add config files in my ThirdParty/package? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: can I override or add config files in my ThirdParty/package? (/showthread.php?tid=75644)



can I override or add config files in my ThirdParty/package? - midav - 02-29-2020

Good day, can I redefine the config files in my package, for example, I want to add the Filters.php config file so that I can create it in my app / ThirdParty / lebid / Config / Filters.php package and just add it.

I just want to make for myself a mini CMS, and when I installed the framework, just drop my CMS package into the ThirdParty folder and start working so that I don’t do the settings in app / Config, so that I can do all the settings in my package, such as ( Autoload.php, Filters.php, Toolbar.php, Validation.php)


RE: can I override or add config files in my ThirdParty/package? - MGatner - 03-01-2020

You can do that but Config files in App will always take precedence, so you would need to (re)move them. You might also want to look into Registrars, which might account for some of the behavior you are after: https://codeigniter4.github.io/userguide/general/configuration.html#registrars


RE: can I override or add config files in my ThirdParty/package? - midav - 03-01-2020

(03-01-2020, 08:37 AM)MGatner Wrote: You can do that but Config files in App will always take precedence, so you would need to (re)move them. You might also want to look into Registrars, which might account for some of the behavior you are after: https://codeigniter4.github.io/userguide/general/configuration.html#registrars
so I want to do this so that I drop 3 packages into the ThirdParty folder (lebid, myth-auth, smarty) and everything works right away so that I don’t get into any other config files (Autoload.php, Filters.php, Toolbar.php, Validation .php) on the base installation. To configure the necessary config in my package, that's all.


RE: can I override or add config files in my ThirdParty/package? - midav - 03-01-2020

I tried the registrar, and it gets to redistribute the necessary config to me, for example, add app/Config/Filters.php add
public static $registrars = [
    '\CMS\Config\MyFilters'
];
and then it works, and if you need to reassign several configs, then you need to go into each one and substitute it. somehow it is possible for example to create my Kong for example app/Config/CMS.php and in it to specify all the config files that I want to redistribute?


RE: can I override or add config files in my ThirdParty/package? - InsiteFX - 03-02-2020

You would also need the email config file because Myth::Auth use it also.


RE: can I override or add config files in my ThirdParty/package? - midav - 03-02-2020

(03-02-2020, 08:59 AM)InsiteFX Wrote: You would also need the email config file because Myth::Auth use it also.
I know this, I wonder if it is possible to do so as I wrote above.

or I think to do everything in APP and use to expand my mini CMS. https://codeigniter4.github.io/userguide/general/modules.html

And when someone gives my mini CMS, they will need to fill in the APP folder and the module folder

And when I do a new project I will need to fill in the APP folder and the modules folder