1. Go to this page and download the library: Download eru123/venv 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/ */
eru123 / venv example snippets
tect system environment variables
# Move all system env variables to virtual env
venv_protect();
# load .env file
venv_load(__DIR__ . '/.env');
# Set app array
venv_set('app', [
'version' => '1.0.0',
'name' => 'php-venv',
]);
# Modify app.name value using dot notation
venv_set('app.name', 'php-venv2');
# Merge an array to virtual env
# Note: dot notation will not work on this function, and might override array values
# Note: array will be ignored if all elements are not key-value pair (can be potential bug if not used properly)
venv_merge(['key' => 'pair'], ['this array will be ignored'], ['key2' => 'pair2']);
# Get all virtual env variables
print_r(venv());
# Get app.version value using dot notation
print_r(venv('app.version'));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.