2017 © Pedro Peláez
 

library env-analyzer

Analyzes environment files

image

apollo11/env-analyzer

Analyzes environment files

  • Tuesday, April 24, 2018
  • by arboshiki
  • Repository
  • 3 Watchers
  • 7 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 100 % Grown

The README.md

Env / PHP analyzer

Analyzes env dist file and allows to insert missing variables to env file through the console, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist apollo11/env-analyzer "~1.0"

or add, (*4)

"apollo11/env-analyzer": "~1.0"

to the require section of your composer.json file and run php composer.phar update command., (*5)

The package offers:, (*6)

  1. Env class which can store .env and .env.dist file path, as well as, getting the difference between those files.
  2. Php class which can store env.php and env.dist.php file path, as well as, getting the difference between those files. Note: both php files should return Associative array either strings or integers.
  3. Analyzer class which is used for getting the difference of files through the console

Basic Usage

Generally, the best use case is to call Analyzer from console, because it gives the ability to insert the value of the missing data, as well., (*7)

Add the following code to your console command, (*8)

Analyzer::analyzeEnv($pathToEnv, $pathToEnvDist);

or add, (*9)

Analyzer::analyzePhp($pathToPhp, $pathToDistPhp);

Usage from Composer

You can also run Analyzer on Composer Scripts, (*10)

Add the following code to the extra in project's composer.json file, (*11)

"apollo11-parameters": {
            //env-path and env-dist-path for analyzing env files
            "env-path": ".env",
            "env-dist-path": ".env.dist",
            //php-env-path and php-env-dist-path for analyzing php files
            "php-env-path": "env.php",
            "php-env-dist-path": "env.dist.php"
  },

You should also call the analyzer method from composer script. In this example, I call it from post-install-cmd, which is triggered after composer install is finished. Just add the following code to script in composer.json file, (*12)

"post-install-cmd": [
            //Analyzer for env files
            "\\apollo11\\envAnalyzer\\Analyzer::analyzeEnvComposer",
            //Analyzer for php files
            "\\apollo11\\envAnalyzer\\Analyzer::analyzePhpComposer"
 ],

The Versions

24/04 2018

dev-master

9999999-dev https://github.com/apolloeleven/env-analyzer

Analyzes environment files

  Sources   Download

The Requires

 

by Saiat Kalbiev

environment env env-checker env-analyzer

24/04 2018

v1.0.0

1.0.0.0 https://github.com/apolloeleven/env-analyzer

Analyzes environment files

  Sources   Download

The Requires

 

by Saiat Kalbiev

environment env env-checker env-analyzer