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

                    Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

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

                    Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form