.ENV vars in Composer.json

Has anyone had experience with creating .ENV vars and using them in the composer.json file?

I’d like to create the variable “THEME_NAME=thethemename” and use it like so:

  "type": "package",
  "package": {
    "name": "packageowner/{$_ENV['THEME_NAME']}",
    "version": "1.0.0",
    "type": "wordpress-theme",
    "dist": {
      "type": "zip",
      "url": "http://example.com/file.zip"
    "require" : {
      "fancyguy/webroot-installer": "1.1.0"

"j2designpartnership/{$_ENV['THEME_NAME']}": "~1.0.0" 

My experience with the .ENV plugin is limited to Bedrock so I’m not sure if those vars can even be used in JSON files.


Pretty sure it still isn’t possible unfortunately. There’s been some tickets about it: