vercel-community / php

🐘 PHP Runtime for ▲ Vercel Serverless Functions (support 7.4-8.3)

Home Page:https://php.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is Vercel's .env CLI compatible with vercel-php?

varunsingh87 opened this issue · comments

Question

Are the vercel env commands usable for the vercel-php runtime? I want to store some secrets that are encrypted through Vercel. They are stored in my gitignored .env file. Can I access this in PHP?

Hi. Yup, Environment Variables are supported. :-)

  • It works seamless on Vercel platform, after deployment.
  • Locally, it depends as you start your local development server.
    • SOME_ENV=foo php -S localhost:8000 api/index.php

Thank you!
How do we access these variables in PHP? The docs only talk about JavaScript

I am going to try using PHP's $_ENV

Yes, use $_ENV or getenv().

I will put it on vercel-php doc.

Thank you very much!