PHP Class Sven\FlexEnv\Env

显示文件 Open project: svenluijten/flex-env Class Usage Examples

Protected Properties

Property Type Description
$path string
$previous string

Public Methods

Method Description
__construct ( string $path ) Instantiate the Env.
all ( ) : array Gets all the key/value pairs from the .env file.
copy ( string $destination, boolean $excludeValues = false ) : boolean Copy the .env file to the given destination.
delete ( string $key ) : Env Delete an entry from the .env file.
get ( string $key ) : string Get an entry from the .env file by key.
getPath ( ) : string Get the full path to the .env file.
replaceInFile ( string $old, string $new, integer $append ) : Env Replace a part of the .env file.
rollback ( ) : Env Rolls the .env file back to the way it was before performing the command.
set ( string $key, string $value, boolean $linebreak = false ) : Env Set the value of the given key to the value supplied.

Private Methods

Method Description
parseFile ( ) : Collection Parse the .env file contents for easier handling.

Method Details

__construct() public method

Instantiate the Env.
public __construct ( string $path )
$path string

all() public method

Gets all the key/value pairs from the .env file.
public all ( ) : array
return array

copy() public method

Copy the .env file to the given destination.
public copy ( string $destination, boolean $excludeValues = false ) : boolean
$destination string Full path to copy the file to
$excludeValues boolean Whether or not to include values
return boolean

delete() public method

Delete an entry from the .env file.
public delete ( string $key ) : Env
$key string
return Env

get() public method

Get an entry from the .env file by key.
public get ( string $key ) : string
$key string
return string

getPath() public method

Get the full path to the .env file.
public getPath ( ) : string
return string

replaceInFile() public method

Replace a part of the .env file.
public replaceInFile ( string $old, string $new, integer $append ) : Env
$old string
$new string
$append integer
return Env

rollback() public method

Rolls the .env file back to the way it was before performing the command.
public rollback ( ) : Env
return Env

set() public method

Set the value of the given key to the value supplied.
public set ( string $key, string $value, boolean $linebreak = false ) : Env
$key string
$value string
$linebreak boolean
return Env

Property Details

$path protected_oe property

protected string $path
return string

$previous protected_oe property

protected string $previous
return string