PHP code example of 68publishers / environment

1. Go to this page and download the library: Download 68publishers/environment 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/ */

    

68publishers / environment example snippets




use SixtyEightPublishers\Environment\Debug;
use SixtyEightPublishers\Environment\Bootstrap\EnvBootstrap;

 "--debug_please" is defined (CLI only)
    new Debug\IpAddressDetector([
        '185.141.252.240', // the debug mode is enabled always for this IP address
        '[email protected]', // the debug mode is enabled for this IP address and a cookie called "debug_please" must exist with value "john_dee"
    ], 'debug_please'),
    new Debug\SimpleCookieDetector('ineeddebug123', 'debug_please'), // the debug mode is enabled if a cookie called "debug_please" exists and has the value "ineeddebug123"
    new Debug\EnvDetector(), // the detection is performed from loaded ENV variables, the debug mode is enabled if a variable "APP_DEBUG=1" is defined or if a variable "APP_ENV" has a different value than, "prod"
]);

// All your ENV variables are now accessible in the global arrays `$_ENV` and `$_SERVER`



use Nette\Bootstrap\Configurator;
use SixtyEightPublishers\Environment\Bootstrap\EnvBootstrap;

detectors here
]);

// All your ENV variables are now accessible in the global arrays `$_ENV` and `$_SERVER`
// The debug mode on the configurator is set by the ENV variable `APP_DEBUG`
// The ENV variables are accessible in DI container and Neon configuration as dynamic parameters with prefix `env.` e.g. `%env.APP_ENV%`