Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eliurkis/laravel-env-sync
https://github.com/eliurkis/laravel-env-sync
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/eliurkis/laravel-env-sync
- Owner: eliurkis
- Created: 2021-02-03T22:16:22.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-03T22:29:16.000Z (almost 4 years ago)
- Last Synced: 2024-12-09T10:52:09.889Z (14 days ago)
- Language: PHP
- Size: 39.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Tests](https://github.com/senaranya/Laravel-Env-Sync/workflows/Tests/badge.svg?branch=master&event=push)](https://github.com/senaranya/Laravel-Env-Sync/actions?query=branch%3Amaster)
[![Scrutinizer](https://img.shields.io/scrutinizer/g/senaranya/Laravel-Env-Sync.svg?maxAge=3600)](https://scrutinizer-ci.com/g/senaranya/Laravel-Env-Sync/?branch=master)
![Scrutinizer coverage](https://img.shields.io/scrutinizer/coverage/g/senaranya/Laravel-Env-Sync?style=plastic)# Laravel Env Sync
Keep your .env in sync with your .env.example or vice versa.
It reads the .env.example file and makes suggestions to fill your .env accordingly.
## Installation via Composer
Start by requiring the package with composer
```
composer require eliurkis/laravel-env-sync
```Then, if you use laravel < 5.5, add the `Eli\LaravelEnvSync\EnvSyncServiceProvider::class` service provider to your `config/app.php` file, and that's it
## Usage
### Sync your envs files
You can populate your .env file from the .env.example by using the `php artisan env:sync` command.
The command will tell you if there's anything not in sync between your files and will propose values to add into the .env file.
You can launch the command with the option `--reverse` to fill the .env.example file from the .env file
You can also use `--src` and `--dest` to specify which file you want to use. You must use either both flags, or none.
If you use the `--no-interaction` flag, the command will copy all new keys with their default values.
### Check for diff in your envs files
You can check if your .env is missing some variables from your .env.example by using the `php artisan env:check` command.
The command simply show you which keys are not present in your .env file. This command will return 0 if your files are in sync, and 1 if they are not, so you can use this in a script
Again, you can launch the command with the option `--reverse` or with `--src` and `--dest`.
The command will also dispatch event `Eli\LaravelEnvSync\Events\MissingEnvVars`, which will contain the missing env variables, which could be used in automatic deployments. Event is only fired when there are missing env variables.
### Show diff between your envs files
You can show a table that compares the content of your env files by using the `php artisan env:diff` command.
The command will print a table that compares the content of both .env and .env.example files, and will highlight the missing keys.
You can launch the command with the options `--src` and `--dest`.