Add new environment variables to .env when installing a package

In our company, several internal projects rely on the same copied code parts to handle connections to the same APIs (like: Google Suite, JIRA,…). To avoid copying the same code over and over again for new projects, I want to create Symfony packages that collect these API classes.

The tricky part: I’m looking for a way to add the neccessary env variables automatically to .env, just like Symfony’s recipe structure does itenter link description here. But as these projects should only be used internally, pushing their recipe configuration to a public repository is a no-go for me. Adding a custom recipe server (like the one by moay) looks interesting to me, but needs additional configuration in each projects composer.json.

Is there any better way to resolve this, such that I could simply define the needed variables solely in my project, such that they get added to .env without any additional magic?

NB: anything that requires symfony/flex is fine, as this should be part of all new projects in our company

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *