Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

flap152's avatar
Level 11

vapor.yml syntax - environment variables

Where can we find a detailed syntax of the vapor.yml file?

I googled and used search on vapor.laravel.com and could only find samples and tutorials that are not exhaustive.

I'm looking for a way to set an environment variable in vapor.yml. I know how to set variables on the website, but some variables are more like switches/variants from one envrionment to another and I find it easier to see the difference in the yaml than having to log in.

Thanks

0 likes
2 replies
crnkovic's avatar
crnkovic
Best Answer
Level 43

AFAIK you cannot set environment variables through the vapor.yml file, only through the UI in the environment settings.

You can find the Vapor documentation here: http://docs.vapor.build

If you're using CI and absolutely need to do this, you may do a hacky way to do this. You may define your environment variables in the CI system, write a little bash script that does vapor env:pull, updates the .env file and pushes the environment variables before deploying, but I don't really recommend doing this. Just use the UI.

flap152's avatar
Level 11

Good point about env:pull and env:push. At least I can "document" the settings I put in .env for each environment. Obviously move every secret to "secrets" before commit to Git.

Otherwise how would one easily/safely maintain a few environments of the same application with a few variants, similar to the tennants concept (without implementing tennants)? demo/pre-prod/customerX/customerY.

Still wish there was a reference guide to the vapor.yml file. The documentation tells you of a few possible entries but surely is not exhaustive.

Call me old-school or just plain old, but I used to own and read reference guides to APIs and function libraries, which do not serve the same purpose as documentation and tutorials.

Please or to participate in this conversation.