railken / dotenv
Installs: 70
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/railken/dotenv
Requires
- php: >=7.1
- vlucas/phpdotenv: ^2.5
Requires (Dev)
- phpunit/phpunit: ~7.0
This package is auto-updated.
Last update: 2025-09-28 09:09:27 UTC
README
This library is an extension of Dotenv that grants you the ability to update variables into the .env
file.
You can either update, append or remove a variable.
Requirements
PHP 7.1 and later.
Installation
You can install it via Composer by typing the following command:
composer require railken/dotenv
Usage
A simple usage looks like:
use Railken\Dotenv\Dotenv; // Location of the directory that contains the .env file $path = __DIR__; $dotenv = new Dotenv($path); $dotenv->load(); $dotenv->updateVariable("APP_KEY", "foo"); $dotenv->appendVariable("NEW_KEY", 2); $dotenv->removeVariable("NEW_KEY");
The class Railken\Dotenv\Dotenv
simply extends the class Dotenv\Dotenv
as you can see here
If you wish you can use directly the Railken\Dotenv\Storage
use Railken\Dotenv\Storage; // Location of the directory that contains the .env file $path = __DIR__; $storage = new Storage($path); $storage->update("APP_KEY", "foo"); $storage->append("NEW_KEY", 2); $storage->remove("NEW_KEY");