title: How can I use php to populate a manifest.json file?
body: <p>I have a manifest.json file that loads correctly when placed in the root directory of my wesite. Instead of it being a static file, I would like to use php variables from within my site to populate the values inside of the manifest. </p>
  
  <p>I can't find any information on this <a href="https://www.w3.org/TR/appmanifest/" rel="nofollow noreferrer">in the spec</a>, and I'm not sure if it's possible.</p>
  
  <p>I've tried switching the name of my manifest to <code>manifest.php</code> and used <code>header('Content-Type: application/json')</code> within it. </p>
  
  <p>Inside my index file head:</p>
  
  <pre><code>&lt;script src="&lt;?php echo $SITE_URL;?&gt;/main.js"&gt;&lt;/script&gt;
  &lt;script src="&lt;?php echo $SITE_URL;?&gt;/sw.js"&gt;&lt;/script&gt;
  &lt;link rel="manifest" href="&lt;?php echo $SITE_URL;?&gt;/manifest.php"&gt;
  </code></pre>
  
  <p>Inside my manifest.php:</p>
  
  <pre><code>&lt;?php header('Content-Type: application/json');
  echo "
  {
    \"name\": \"$SiteName\",
    \"gcm_user_visible_only\": true,
    \"short_name\": \"$Name\",
    \"description\": \"$PageDescription.\",
    \"start_url\": \"/index.php\",
    \"display\": \"standalone\",
    \"orientation\": \"portrait\",
    \"background_color\": \"$darkblue\",
    \"theme_color\": \"#f0f0f0\",
    \"icons\": [{
      \"src\": \"logo-load.png\",
      \"sizes\": \"96x96 128x128 144x144\",
      \"type\": \"image/png\"
    },{
      \"src\": \"logo-icon.png\",
      \"sizes\": \"48x48 72x72\",
      \"type\": \"image/png\"     
    }]
  }
  ";
  ?&gt;
  </code></pre>
  
  <p>The variables <code>$SiteName, $Name, $PageDescription, $darkblue, etc</code> are all defined within my document head before the manifest.php is loaded.</p>
  
  <p>Is what I'm trying possible? </p>