Best/way Right way to add custom config element

Hey guys, hoping to borrow from your expertise on my Magento learning journey.

I found an existing block of code that executes in Magento as a cron job. There are a couple of lines of code that I want to have conditionally run based on what would be a new configuration parameter.

In a Laravel app, I would just open env.php and add it, use a config() helper to read that at runtime, and execute based on my requirements.

I’m trying to find something similar in Magento, but I’m running into docs that state things like the “deployment config in env.php and config.php is not extensible” ..and .. “you can create new configs per module” with a few xml/xsd files and some coding….

Does it really take all that to add a simple parameter to a global config? I’m just looking to be able to do something like this:

<global config file somewhere>


Then the php that runs based on cron, I just want to reference that value ..probably something like…

if ($magento-app->config(‘MYNEWPARM’) == TRUE) then { whatever }

Please tell me this is straight-forward and I just haven’t found the right docs yet!


submitted by /u/kwisatzcraperach
[link] [comments]