title: How do I get an environment parameter in a controller In Symfony 3.4?
body: <p>In the <code>dev</code> environment of a Symfony 3.4 application, I am trying to store credentials as environment variables. I can’t get it to work, and I can’t figure out what’s missing. This is what I have:</p>
  
  <p>In <code>app\config\.env</code> I have an API key defined, like so:</p>
  
  <pre><code>GOOGLE_DEVELOPER_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  </code></pre>
  
  <p>In <code>app\config\services.yml</code> I have:</p>
  
  <pre><code>parameters:
      google.developer.key: "%env(GOOGLE_DEVELOPER_KEY)%"
  </code></pre>
  
  <p>In one of my controllers, I want to pass this parameter to an object like so:</p>
  
  <pre><code>    $client = new \Google_Client();
      $client-&gt;setDeveloperKey($this-&gt;getParameter('google.developer.key'));
  </code></pre>
  
  <p>To me, that setup looks fine, but when I try to run it, I get a <code>EnvNotFoundException</code> with the following message:</p>
  
  <blockquote>
    <p>Environment variable not found: "GOOGLE_DEVELOPER_KEY".</p>
  </blockquote>
  
  <p>When I put the key in <code>app\config\services.yml</code> directly, it works just fine:</p>
  
  <pre><code>parameters:
      google.developer.key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  </code></pre>
  
  <p>(But that’s not what I want, for a variety of reasons.)</p>
  
  <p>I cleared the <code>dev</code> cache, restarted the web server, read the relevant Symfony Documentation (I think), but no luck. I guess I’m missing a step, but I can’t figure out what that would be. Any hints would be appreciated.</p>