PHP code example of 24hoursmedia / php-env-inject

1. Go to this page and download the library: Download 24hoursmedia/php-env-inject library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

24hoursmedia / php-env-inject example snippets



use T4\EnvInject\EnvInject;
putenv('YOUR_NAME=John Doe');

echo EnvInject::interpolate('Hello ${YOUR_NAME}! ${MESSAGE:-Have a nice day!}');
// Hello John Doe! Have a nice day!


use T4\EnvInject\JsonEnvInject;
putenv('FOO=f"o"o');
echo JsonEnvInject::interpolate('{"foo":"${FOO}"}');
// {"foo":"f\"o\"o"}