PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Zacchaeus Bolaji   PHP Env Export   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Env Export
Export environment variables to a file
Author: By
Last change:
Date: 2 months ago
Size: 2,555 bytes
 

Contents

Class file image Download

PHP Env Export

CircleCI Latest Stable Version Total Downloads License Build Status Scrutinizer Code Quality

PHP Package to export env keys to new file

Installation

You can install the package via composer:

composer require --dev djunehor/php-env-export

Laravel 5.5 and above

The package will automatically register itself, so you can start using it immediately.

Laravel 5.4 and older

In Laravel version 5.4 and older, you have to add the service provider in config/app.php file manually:

'providers' => [
    // ...
    Djunehor\Env\EnvExportServiceProvider::class,
];

Lumen

After installing the package, you will have to register it in bootstrap/app.php file manually:

// Register Service Providers
    // ...
    $app->register(Djunehor\Env\EnvExportServiceProvider::class);
];

Usage

via helper method

$from = '.env'; //default value is .env
$to = '.env.example'; // default value is .env.example
export_env($from, $to);

Via Laravel Artisan Command

  • `php artisan env:export` uses default values
  • Or `php artisan env:export --from=.env --to='.env.example`
  • Or `php artisan env:export -f=.env -to='.env.example`

Via Console/Terminal

  • At the root of your application, run `php --run "require 'vendor/djunehor/php-env-export/src/Export.php'; export_env();"`

Contributing

  • Fork this project
  • Clone to your repo
  • Make your changes and run tests `composer test`
  • Push and create a pull request