This package create command to set value to .env key.
krasomir/laravel-env-set-command is a Laravel package for this package create command to set value to .env key..
It currently has 0 GitHub stars and 3.320 downloads on Packagist (latest version v2.1.0).
Install it with composer require krasomir/laravel-env-set-command.
Discover more Laravel packages by krasomir
or browse all Laravel packages to compare alternatives.
Last updated
This is my first Laravel package inspired (copied and adopted to L10) by package of Liam Hammett 'laravel-env-set-command' which is not maintained anymore.
You can install the package via composer:
composer require krasomir/laravel-env-set-command
When running the env:set artisan command, you must provide both a key and value as two arguments.
$ php artisan env:set app_name Example
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to 'Example'
You can also set values with spaces by wrapping them in quotes.
$ php artisan env:set app_name "Example App"
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to '"Example App"'
The command will also create new environment variables if an existing one does not exist.
$ php artisan env:set editor=vscode
# A new environment variable with key 'EDITOR' has been set to 'vscode'
Instead of two arguments split by a space, you can also mimic the .env file format by supplying KEY=VALUE.
$ php artisan env:set app_name=Example
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to 'Example'
The command will do its best to stop any invalid inputs.
$ php artisan env:set @pp_n@me Laravel
# Invalid environment key @pp_n@me! Only use letters and underscores
You can specify the external .env file in the third optional argument.
$ php artisan env:set APP_NAME TestApp /var/www/my_own_env.env
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to 'TestApp'
Or in the second parameter if you use key=value syntax.
$ php artisan env:set APP_NAME=TestApp /var/www/my_own_env.env
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to 'TestApp'
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.