Giter VIP home page Giter VIP logo

env-analyzer's Introduction

Env / PHP analyzer

Analyzes env dist file and allows to insert missing variables to env file through the console

Installation

The preferred way to install this extension is through composer.

Either run

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

or add

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

to the require section of your composer.json file and run php composer.phar update command.

The package offers:

  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.

Add the following code to your console command

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

or add

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

Usage from Composer

You can also run Analyzer on Composer Scripts

Add the following code to the extra in project's composer.json file

"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

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

env-analyzer's People

Contributors

saiat3 avatar thecodeholic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.