Download the PHP package akmnahid/laravel-local-env-support without Composer
On this page you can find all versions of the php package akmnahid/laravel-local-env-support. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download akmnahid/laravel-local-env-support
More information about akmnahid/laravel-local-env-support
Files in akmnahid/laravel-local-env-support
Package laravel-local-env-support
Short Description The laravel-local-env-support plugin allows Laravel developers to seamlessly integrate environment-specific .env.local configurations, enhancing adaptability across different development stages.
License MIT
Homepage https://github.com/akmnahid/laravel-local-env-support
Informations about the package laravel-local-env-support
Laravel EnvLocal Support
A Laravel package to add support for .env.local
files, allowing you to override environment variables defined in the main .env
file without modifying it. This is particularly useful for local development and testing environments.
Table of Contents
- Installation
- Usage
- Features
- Requirements
- License
Installation
You can install this package via Composer:
To install directly from VCS repository in your composer.json
:
Then run:
Usage
-
Create a
.env.local
file in the root directory of your Laravel project. -
Add environment variables to
.env.local
that you wish to override from the main.env
file.Example
.env.local
: -
Ensure
.env.local
is added to your.gitignore
file to prevent it from being committed to version control. -
Clear the configuration cache if you have previously cached your configurations:
- Run your application as usual. Variables defined in
.env.local
will override those in.env
.
Features
-
Override Environment Variables: Variables in
.env.local
will override those defined in.env
. -
Easy to Use: Simply install the package and create a
.env.local
file. - Auto-Discovery: The package uses Laravel's auto-discovery feature, so no additional setup is required.
Requirements
- PHP: >=7.3
- Laravel: >=8.0
- Dependencies:
vlucas/phpdotenv
: >=5.5
License
This project is licensed under the MIT License. See the LICENSE file for details.
Additional Notes
-
Environment File Order: The variables in
.env.local
will override those in.env
. This allows you to keep default settings in.env
and customize only the necessary variables in.env.local
. -
Version Control: It's recommended to add
.env.local
to your.gitignore
file to prevent sensitive data from being committed to your repository. -
Configuration Caching: If you cache your configurations using
php artisan config:cache
, remember to clear the cache whenever you make changes to your environment files. - Auto-Discovery: This package supports Laravel's package auto-discovery, so you don't need to manually add the service provider to your
config/app.php
file. - To Add Manually: Add following to your config/app.php file:
Troubleshooting
-
Variables Not Overriding: If the variables from
.env.local
are not overriding those from.env
, ensure that:- The
.env.local
file is located in the root directory of your Laravel project. - You have cleared the configuration cache using
php artisan config:clear
. - There are no syntax errors in your
.env.local
file.
- The
- Cache Issues: Remember that environment variables are cached when you run
php artisan config:cache
. Always clear the cache after making changes to your environment files.
Credits
- Author: Nahid Hossain
- Website: http://www.akmnahid.com
- GitHub: https://github.com/akmnahid/laravel-local-env-support
Support
If you encounter any issues or have questions, feel free to open an issue on GitHub .
Versioning
This project adheres to Semantic Versioning. For the versions available, see the tags on this repository.
Changelog
All notable changes to this project will be documented in this section.
- v1.0.3: Updated readme.md
- v1.0.2: Updates with new codebases
- v1.0.1: Initial release with support for loading
.env.local
files. - v1.0.0: Initial release with support for loading
.env.local
files.
Feel free to customize and extend this package to suit your specific needs. Contributions and suggestions are welcome!