PHP code example of arwg / env-knife

1. Go to this page and download the library: Download arwg/env-knife 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/ */

    

arwg / env-knife example snippets



      $envKnife = new EnvKnife();
      
      // For the first parameter, you can set any function name you are using for loading environment variables.
      
      // Detect funcs such as env('URL'), env("APP_CRITICAL", 5) 
      // !! Variable types are limited to 'string, numeric, boolean'
      $envKnife->parseResults('env', base_path(), ['app', 'bootstrap', 'config', 'routes']);
      
      // Detect when 'env('URL') returns null'
      $results = $envKnife->getEmptyResults();     

      // Detect funcs such as config('abc'), config("ABC_CRITICAL", 5) 
      // !! Variable types are limited to 'string, numeric, boolean'
      $envKnife->parseResults('config', base_path(), ['app', 'bootstrap', 'config']);
      
      $results = $envKnife->getEmptyResults();
      
      // Detect errors such as "undefined index 'c'" in config('abc')['v']['c'] in case that there is no 'c'.
      $results2 = $envKnife->getErrorResults();