fadllabanie/env-editor
最新稳定版本:v1.0.7
Composer 安装命令:
composer require fadllabanie/env-editor
包简介
A Laravel package to edit .env files from a web interface.
README 文档
README
| Version | Features |
|---|---|
| V.1 | Edit env file |
EnvEditor is a Laravel package that allows you to easily view and edit your .env file through a web interface.
Features
- View and edit
.envvariables in a form-based interface. - Add new key-value pairs.
- Remove existing keys.
- IP restriction for security.
- Username/password authentication.
Installation
Follow these steps to install the package into your Laravel project:
- Install the package via Composer:
composer require fadllabanie/env-editor
- Publish the package configuration and views:
php artisan vendor:publish --tag=config --provider="Fadllabanie\EnvEditor\EnvEditorServiceProvider"
This will create the config/env-editor php file and publish the views required for the UI.
- Add the following environment variables to your
.envfile:
ENV_EDITOR_ENABLE=true ENV_EDITOR_USERNAME=admin ENV_EDITOR_PASSWORD=password ENV_EDITOR_WHITE_IPS_LIST=127.0.0.1
- Optionally, update the configuration in
config/env-editorphp to customize theusername,password, andIPsrestrictions.
Usage
-
Access the EnvEditor Interface: Visit the route
/env-editor/loginto log in and access the interface. -
Authentication: Use the username and password specified in the
.envfile (or the default ones set inconfig/env-editor.php). -
Edit .env File: Once authenticated, you can view the current
.envfile, modify existing variables, or add new key-value pairs. -
Logout: You can log out from the interface at any time using the logout button.
Security
-
IP Restriction: You can restrict access by IP using the
ENV_EDITOR_WHITE_IPS_LISTenvironment variable. Add a comma-separated list of allowed IP addresses. -
Session Time: The session expires after 2 minutes by default.
Configuration
After publishing the configuration file, you can modify the following settings in config/env-editor.php:
return [ 'env-editor-enable' => env('ENV_EDITOR_ENABLE', true), 'white_ips_list' => env('ENV_EDITOR_WHITE_IPS_LIST', ['127.0.0.1']), 'username' => env('ENV_EDITOR_USERNAME', 'admin'), 'password' => env('ENV_EDITOR_PASSWORD', 'password') ];
Clearing Config Cache
you make changes to the .env file or config/env-editor.php, make sure to clear the config cache to reflect the updates:
php artisan config:clear
License
This package is open-source and licensed under the MIT License.
How to Use This:
- Copy the text to a
README.mdfile in the root of your package directory. - Customize any parts (like the IPs, username, or password) according to your specific setup.
- Include instructions for how to install, configure, and use the package.
Let me know if you need any changes or further clarifications!
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-11