Hi everyone,

I was wondering if there ever was or if there is interest in defining a 
standard for configurations / settings that would mostly benefit package 
developers. A few months ago Laravel 5.8 broke a lot of packages by 
changing how .env files are handled, which led to this really good article 
on the subject: 
https://mattallan.me/posts/how-php-environment-variables-actually-work/
A TL;DR is that _ENV and _SERVER are not reliable as they can be disabled 
and getenv is not thread-safe.
There are several packages that provide behavior change or even require 
certain configuration to work that use the getenv. If perhaps there was a 
standard that packages could rely on to get these values, they could avoid 
the quirks of environment variables in PHP.
The Container PSR comes to mind, but that usually involves consumers being 
required to have a Container PSR implemented, which involves a lot more 
than just retrieving primitive values. It's also lacking a PSR that defines 
a standard on how to write to the container.
For these reasons, I was thinking that a PSR focused only on setting / 
getting primitive values similar to how environment variables are being 
used now would be somewhat a powerful, yet simple standard. It could be 
trivial to implement while pushing the problem of handling environment 
variables into the application developers and out of the packages. At the 
end, application developers are usually deciding the environment they will 
run their code and can make decisions based on their needs while package 
developers are writing code that will be running on all sorts of 
environments and as such should try to maximize their reach.


-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/64bcffad-f10e-4aec-a960-5cfcf7301557%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to