WinterEnv

Console command to convert configuration to use .env files.

 class System\Console\WinterEnv
extends Winter\Storm\Console\Command
implements 
    Symfony\Component\Console\Command\SignalableCommandInterface

This creates an .env file with some default configuration values, it also converts the existing PHP-based configuration files to use the env function for values.

Extends

Class Description
Command

Command base class Contains utilities to make developing CLI commands nicer

Traits

Trait Description
HandlesCleanup

Console Command Trait that injects cross-platform signal handling to trigger cleanup on exit through the handleCleanup() method on the implementing class.

ProvidesAutocompletion

Console Command Trait that injects cross-platform signal handling to trigger cleanup on exit through the handleCleanup() method on the implementing class.

Properties

protected $description : mixed

The console command description.

protected $name : mixed

The console command name.

protected $protectedKeys : array

The env keys that need to have their original values removed from the config files

inherited protected $laravel : Winter\Storm\Foundation\Application

Inherited from Command

inherited protected $replaces : array

Inherited from Command

List of commands that this command replaces (aliases)

Methods

public __construct ()

Create a new command instance.

Returns
mixed

public confirmToProceed (string $warning = "Application In Production!", Closure | bool | null $callback = null) : bool

Confirm before proceeding with the action.

This method only asks for confirmation in production.

Parameters
Property Description
$warning
string
$callback
Closure | bool | null
Returns
bool

public handle () : integer

Execute the console command.

Returns
integer

protected config () : array

Returns a map of env keys to php config keys for db configs

Returns
array

protected dbConfig () : array

Returns a map of env keys to php config keys for db configs

Returns
array

protected getConfigPath (string $config) : string

Get the full path of a config file

Parameters
Property Description
$config
string
Returns
string

protected getKeyValuePair (string $envKey, string $configKey) : array

Returns an array containing the key as the first element and the value as the second if the key is not a protected key; otherwise the value will be an empty string

Parameters
Property Description
$envKey
string
$configKey
string
Returns
array

protected mailConfig () : array

Returns a map of env keys to php config keys for mail configs

Returns
array

protected updateConfigFiles () : void

Update config files with env function calls

Returns
void

protected updateEnvFile () : void

Set env keys to their config values within the EnvFile object

Returns
void

inherited public alert (string $string, int | string | null $verbosity = null) : void

Inherited from Command

Write a string in an alert box.

Parameters
Property Description
$string
string
$verbosity
int | string | null
Returns
void

inherited public complete (Symfony\Component\Console\Completion\CompletionInput $input, Symfony\Component\Console\Completion\CompletionSuggestions $suggestions) : void

Provide autocompletion for this command's input

Parameters
Property Description
$input
Symfony\Component\Console\Completion\CompletionInput
$suggestions
Symfony\Component\Console\Completion\CompletionSuggestions
Returns
void

inherited public error (string $string, int | string | null $verbosity = null) : void

Inherited from Command

Write a string as error output.

Parameters
Property Description
$string
string
$verbosity
int | string | null
Returns
void

inherited public getSubscribedSignals () : array

Inherited from HandlesCleanup

Returns the process signals this command listens to

Returns
array

inherited public handleSignal (integer $signal) : void

Inherited from HandlesCleanup

Handle the provided Unix process signal

Parameters
Property Description
$signal
integer
Returns
void

inherited public handleWindowsSignal (integer $event) : void

Inherited from HandlesCleanup

Handle the provided Windows process singal.

Parameters
Property Description
$event
integer
Returns
void
Copyright © 2024 Winter CMS