1. Go to this page and download the library: Download yatero/enivronment-picker 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/ */
yatero / enivronment-picker example snippets
$environments = array(
'local' => '/^(localhost(:{d}+)?)|(127\.0\.0\.1(:{d}+)?)$/i',
'staging' => '/^(demo\.my-website\.com)|(8\.8\.8\.8)$/i'
);
// Initialize environments
\Yatero\EnvironmentPicker\EnvironmentPicker::init($environments);
// Returns the label of the environment for the current URL
\Yatero\EnvironmentPicker\EnvironmentPicker::get();
// Return the label of the environment for the given URL
\Yatero\EnvironmentPicker\EnvironmentPicker::get('https://demo.my-website.com/foo/bar');
$environments = array(
'local' => null,
'staging' => null
);
// Initialize environments
\Yatero\EnvironmentPicker\EnvironmentPicker::init($environments);
// Before getting the current environment make sure that you have the right variable name
\Yatero\EnvironmentPicker\EnvironmentPicker::envVarKey('MY_VAR');
\Yatero\EnvironmentPicker\EnvironmentPicker::get();
$environments = array(
'local' => '/^(localhost(:{d}+)?)|(127\.0\.0\.1(:{d}+)?)$/i',
'staging' => '/^(demo\.my-website\.com)|(8\.8\.8\.8)$/i'
);
// Initialize environments
\Yatero\EnvironmentPicker\EnvironmentPicker::init($environments);
// Before getting the current environment make sure that you have the right variable name
\Yatero\EnvironmentPicker\EnvironmentPicker::envVarKey('MY_VAR');
\Yatero\EnvironmentPicker\EnvironmentPicker::get();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.