Download the PHP package boomdraw/laravel-dotenv without Composer
On this page you can find all versions of the php package boomdraw/laravel-dotenv. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-dotenv
Laravel Dotenv Manager
The package that allows read and write .env
file variables
Installation
Via Composer
The package will automatically register itself.
You can publish the config file with:
Usage and methods
all
The function returns all .env
vars as an \Illuminate\Support\Collection
object.
set
The function writes the .env
variable regardless of the variable existence.
The function writes the .env
variable if it does not exist or empty.
add
The function adds the .env
variable if does not exist.
put
The function updates .env
variable if it exists.
The function updates .env
variable if it exists and empty.
delete
The function deletes .env
variable.
An array of keys to delete can be passed as $key
variable.
Setters features
You can pass data as an array for setters (set
, add
, put
):
Dotenv::set['key1' => 'value1', 'key2' => 'value2']
Setters transform variable name removing quotes ('
, "
),
replacing spaces (`) and hyphens (
-) with an underscore (
_`) and transforming name to uppercase.
For example Dotenv::set('foo bar', 'baz')
will write FOO_BAR=baz
to .env
file.
All setters and delete
will rewrite .env
file immediately.
reload
The function reloads .env
file from the filesystem.
Collection methods
You can call all of Collection methods. For example:
Dotenv::get('APP_NAME')
returns APP_NAME
value.
Dotenv::has('APP_NAME')
checks APP_NAME
variable existence.
All collection methods are called for Dotenv
collection copy, so any changes to collection will not affect .env
file
and Dotenv
content.
Testing
You can run the tests with:
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.