Magento 2. Retrieve information from env.php programmaticallyMagento 2 - How to retrieve product informationswhat is entity when create an order using REST apiMagento 2. Create customer account programmatically with no password and confirmation requiredMagento 2 apply tax class programmatically to customerMagento 2 php bin/magento setup:install WITHOUT sample dataMagento 2.2: moving configs from config.php to env.php after app:config:dumpSystem-specific env.php values are included in database config snapshotColumn value display wrong when export CSV in magento 2 admin UI component grid in magento 2Magento 2. Retrieve information from env.php in the js files programmaticallyAdd additional text to email template container

Can attackers change the public key of certificate during the SSL handshake

Minimum effort to detect a solved Rubik's Cube

How to realistically deal with a shield user?

How to approach protecting my code as a research assistant? Should I be worried in the first place?

Why is Chromosome 1 called Chromosome 1?

Tile the chessboard with four-colored triominoes

Did WWII Japanese soldiers engage in cannibalism of their enemies?

How to check a file was encrypted (really & correctly)

Plato and the knowledge of the forms

Can chords be inferred from melody alone?

Did Apollo leave poop on the moon?

What could prevent players from leaving an island?

Is space radiation a risk for space film photography, and how is this prevented?

Write The Shortest Program To Check If A Binary Tree Is Balanced

The meaning of "scale" in "because diversions scale so easily wealth becomes concentrated"

Purchased new computer from DELL with pre-installed Ubuntu. Won't boot. Should assume its an error from DELL?

What does the ISO setting for mechanical 35mm film cameras actually do?

Can I enter a rental property without giving notice if I'm afraid a tenant may be hurt?

How to touch up scratches on a black anodized aluminum flashlight?

Why is the Vasa Museum in Stockholm so Popular?

Non-small objects in categories

Why do cheap flights with a layover get more expensive when you split them up into separate flights?

What prevents ads from reading my password as I type it?

Is "safes" an acceptable alternative to "makes safe"



Magento 2. Retrieve information from env.php programmatically


Magento 2 - How to retrieve product informationswhat is entity when create an order using REST apiMagento 2. Create customer account programmatically with no password and confirmation requiredMagento 2 apply tax class programmatically to customerMagento 2 php bin/magento setup:install WITHOUT sample dataMagento 2.2: moving configs from config.php to env.php after app:config:dumpSystem-specific env.php values are included in database config snapshotColumn value display wrong when export CSV in magento 2 admin UI component grid in magento 2Magento 2. Retrieve information from env.php in the js files programmaticallyAdd additional text to email template container






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








9















I wish to read and use information stored in my env.php. Is there an entity that I can use to achieve this?



Any tips are highly appreciated.
Thanks.










share|improve this question






























    9















    I wish to read and use information stored in my env.php. Is there an entity that I can use to achieve this?



    Any tips are highly appreciated.
    Thanks.










    share|improve this question


























      9












      9








      9


      2






      I wish to read and use information stored in my env.php. Is there an entity that I can use to achieve this?



      Any tips are highly appreciated.
      Thanks.










      share|improve this question














      I wish to read and use information stored in my env.php. Is there an entity that I can use to achieve this?



      Any tips are highly appreciated.
      Thanks.







      magento2 configuration






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 2 '18 at 13:23









      vitoriodachefvitoriodachef

      1,5284 silver badges29 bronze badges




      1,5284 silver badges29 bronze badges























          1 Answer
          1






          active

          oldest

          votes


















          10














          Have a look at MagentoFrameworkAppDeploymentConfig:



          Inject a deployment config object of MagentoFrameworkAppDeploymentConfig in your code and then retrieve the value like this:



          $deploymentConfig->get('db/connection/default/host'));


          for example:



          $deploymentConfig->get('your/custom/value'));


          For default values, see Magento's deployment configuration.






          share|improve this answer





























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f215778%2fmagento-2-retrieve-information-from-env-php-programmatically%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            10














            Have a look at MagentoFrameworkAppDeploymentConfig:



            Inject a deployment config object of MagentoFrameworkAppDeploymentConfig in your code and then retrieve the value like this:



            $deploymentConfig->get('db/connection/default/host'));


            for example:



            $deploymentConfig->get('your/custom/value'));


            For default values, see Magento's deployment configuration.






            share|improve this answer































              10














              Have a look at MagentoFrameworkAppDeploymentConfig:



              Inject a deployment config object of MagentoFrameworkAppDeploymentConfig in your code and then retrieve the value like this:



              $deploymentConfig->get('db/connection/default/host'));


              for example:



              $deploymentConfig->get('your/custom/value'));


              For default values, see Magento's deployment configuration.






              share|improve this answer





























                10












                10








                10







                Have a look at MagentoFrameworkAppDeploymentConfig:



                Inject a deployment config object of MagentoFrameworkAppDeploymentConfig in your code and then retrieve the value like this:



                $deploymentConfig->get('db/connection/default/host'));


                for example:



                $deploymentConfig->get('your/custom/value'));


                For default values, see Magento's deployment configuration.






                share|improve this answer















                Have a look at MagentoFrameworkAppDeploymentConfig:



                Inject a deployment config object of MagentoFrameworkAppDeploymentConfig in your code and then retrieve the value like this:



                $deploymentConfig->get('db/connection/default/host'));


                for example:



                $deploymentConfig->get('your/custom/value'));


                For default values, see Magento's deployment configuration.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jul 27 at 3:32









                Erfan

                2,60419 silver badges27 bronze badges




                2,60419 silver badges27 bronze badges










                answered Mar 2 '18 at 13:39









                Anna VölklAnna Völkl

                15.8k3 gold badges50 silver badges136 bronze badges




                15.8k3 gold badges50 silver badges136 bronze badges






























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f215778%2fmagento-2-retrieve-information-from-env-php-programmatically%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                    Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                    Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?