title: symfony4 use .env config variables in a service
body: <p>I am using a package that is not especially made for symfony (TNTsearch), and have put all the functions I want to use in a service I called <code>TNTsearchHelper.php</code>. This service requires some variables, including some that could be found in the <code>.env</code> file. I currently define and construct these in my class: </p>
  
  <pre><code>class TntSearchHelper
  {
      public function __construct(EntityManagerInterface $em)
      {
          $this-&gt;em = $em;
  
          $config = [
              'driver'    =&gt; 'mysql',
              'host'      =&gt; 'localhost',
              'database'  =&gt; 'databasename',
              'username'  =&gt; 'user',
              'password'  =&gt; 'pw',
              'storage'   =&gt; 'my/path/to/file',
              'charset'   =&gt; 'utf8',
              'collation' =&gt; 'utf8_general_ci',
          ];
  
          $this-&gt;config = $config;
      }
  </code></pre>
  
  <p>What I would really like is to simply use the variables for my database that are set in the <code>.env</code> file. Is there any way to do this? This service is not registered in <code>services.yaml</code> because this is not neccesary with the <code>autowire: true</code> option, so I don't have any config options/file for my service in the <code>config</code> and wonder if I can keep it that way. </p>