Env icon indicating copy to clipboard operation
Env copied to clipboard

[SUGGESTION] Function to generate a .env file

Open jjvvx opened this issue 8 years ago • 5 comments

This would be super useful for things like auto-generated configuration files written in .env (which is what I'm currently attempting to use)

jjvvx avatar Jan 15 '17 20:01 jjvvx

Can you give a bit more info?

m1 avatar Jan 15 '17 20:01 m1

I mean a way to get a string of a .env-formatted file from an array (or something similar), for example

use M1\Env\Compiler;

$a = [
  'FOO' => 1,
  'BAR' => 'whatever'

echo Compiler::compile($a);

Returns:

FOO=1
BAR="whatever"

jjvvx avatar Jan 16 '17 23:01 jjvvx

I could implement something like this, how would multidimensional arrays work though as Bash doesn't support them.

m1 avatar Jan 17 '17 09:01 m1

Either provide an option to give a callable to handle arrays within an array or just flat-out don't allow them to happen

jjvvx avatar Jan 18 '17 21:01 jjvvx

Hmmm, I'm feeling like just not letting them happen is a better option.

m1 avatar Jan 18 '17 21:01 m1