moh-slimani / laravel-env-write
A package to write to the .env file.
Fund package maintenance!
Mohamed slimani
Requires
- php: ^8.2
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^2.0.1
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.5
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-10-08 05:57:44 UTC
README
LaravelEnvWrite is a Laravel package designed to simplify the process of updating the .env file in Laravel applications. It provides a convenient way to automatically update the environment file during database seeding or from anywhere in the codebase.
Support us
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
Installation
You can install the package via composer:
composer require moh-slimani/laravel-env-write
Configuration
The package doesn't require any additional configuration. Once installed, you can start using it immediately.
Usage
Command Line Interface
The package provides an Artisan command to update the .env file from the command line.
php artisan env:write {key} {value?}
- {key}: The key to update in the .env file. It can be provided either as a single argument or in the format key=value.
- {value}: The value to set for the key. This argument is optional and only required when providing a single argument for the key.
Examples
php artisan env:write APP_ENV production
php artisan env:write APP_KEY=your_app_key
Programmatically
You can also use the package programmatically in your codebase:
use MohSlimani\LaravelEnvWrite\Facades\LaravelEnvWrite; // Update the environment file with a specific key and value LaravelEnvWrite::updateEnvironmentFileWith('APP_ENV', 'production');
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.