All Projects → svenluijten → Flex Env

svenluijten / Flex Env

Licence: mit
🌳 Manage your .env file in Laravel projects through artisan

Projects that are alternatives of or similar to Flex Env

Env Providers
👷 Load Laravel service providers based on your application's environment.
Stars: ✭ 73 (-23.16%)
Mutual labels:  environment-variables, laravel, artisan, package
Artisan View
👀 Manage your views in Laravel projects through artisan
Stars: ✭ 708 (+645.26%)
Mutual labels:  laravel, artisan, package
Picasso
Laravel Image Management and Optimization Package
Stars: ✭ 70 (-26.32%)
Mutual labels:  laravel, package
Laravel Ownership
Laravel Ownership simplify management of Eloquent model's owner.
Stars: ✭ 71 (-25.26%)
Mutual labels:  laravel, package
Laravel Pdf
A Simple package for easily generating PDF documents from HTML. This package is specially for laravel but you can use this without laravel.
Stars: ✭ 79 (-16.84%)
Mutual labels:  laravel, package
Laravel Packme
A CLI starter pack for developing a package with Laravel 5
Stars: ✭ 64 (-32.63%)
Mutual labels:  laravel, package
Watchable
Enable users to watch various models in your application.
Stars: ✭ 65 (-31.58%)
Mutual labels:  laravel, package
Manager
Implementation of the Manager pattern existing in Laravel framework
Stars: ✭ 74 (-22.11%)
Mutual labels:  laravel, package
Webshowu
webshowu—laravel开源项目—秀站分类目录源代码
Stars: ✭ 52 (-45.26%)
Mutual labels:  laravel, artisan
Laravel Package Maker
Get a 📦 skeleton and all other `make` commands from laravel base for package development.
Stars: ✭ 89 (-6.32%)
Mutual labels:  laravel, package
Laravel Nullable Fields
Handles saving empty fields as null for Eloquent models
Stars: ✭ 88 (-7.37%)
Mutual labels:  laravel, package
Laravel Totem
Manage Your Laravel Schedule From A Web Dashboard
Stars: ✭ 1,299 (+1267.37%)
Mutual labels:  laravel, package
Laravel Opcache
Laravel Package for OPcache
Stars: ✭ 1,116 (+1074.74%)
Mutual labels:  laravel, artisan
Shield
The core shield package.
Stars: ✭ 60 (-36.84%)
Mutual labels:  laravel, package
Laravel Mentions
End-to-end mentions in Laravel 5.
Stars: ✭ 68 (-28.42%)
Mutual labels:  laravel, package
Laravel Reviewable
Adds a reviewable feature to your laravel app.
Stars: ✭ 57 (-40%)
Mutual labels:  laravel, package
Laravel Ng Artisan Generators
Laravel artisan AngularJS generators
Stars: ✭ 91 (-4.21%)
Mutual labels:  laravel, artisan
Laravel Dropbox Driver
A storage extension for Dropbox.
Stars: ✭ 42 (-55.79%)
Mutual labels:  laravel, package
Laravel Packager
A cli tool for creating Laravel packages
Stars: ✭ 1,049 (+1004.21%)
Mutual labels:  laravel, package
Laravel Mixpanel
Intuitive drop-in analytics.
Stars: ✭ 80 (-15.79%)
Mutual labels:  laravel, package

flex-env

Laravel FlexEnv

Latest Version on Packagist Total Downloads Software License Build Status StyleCI

This package allows you to create, show, edit, update, and delete entries in your .env file in a Laravel project via php artisan, the command line we all know and love.

Index

Installation

You'll have to follow a couple of simple steps to install this package.

Downloading

Via composer:

$ composer require sven/flex-env:^3.0 --dev

Or add the package to your development dependencies in composer.json and run composer update sven/flex-env to download the package:

{
    "require-dev": {
        "sven/flex-env": "^3.0"
    }
}

Registering the service provider

If you're using Laravel 5.5, you can skip this step. The service provider will have already been registered thanks to auto-discovery.

Otherwise, register Sven\FlexEnv\ServiceProvider::class manually in your AppServiceProvider's register method:

public function register()
{
    if ($this->app->environment() !== 'production') {
        $this->app->register(\Sven\FlexEnv\ServiceProvider::class);
    }    
}

Usage

The commands in this package should now be registered. If you now run php artisan, you will see them in the list:

  • env:set
  • env:delete
  • env:get
  • env:list
  • env:example
  • env:sync

Create or edit an entry

$ php artisan env:set NEW_KEY "your key's value"

If the environment variable NEW_KEY does not exist yet, the new variable will be added to the end of the file.

Delete an entry

$ php artisan env:delete APP_KEY

This will ask for your confirmation. If you want to remove the entry without being asked, use the --force flag:

$ php artisan env:delete APP_KEY --force

Get an entry

$ php artisan env:get APP_URL

http://localhost

List all entries

To get a list of all entries in your .env file, use the env:list command:

$ php artisan env:list

+------------------------+-----------------------------------------------------+
| Key                    | Value                                               |
+------------------------+-----------------------------------------------------+
| APP_NAME               | Laravel                                             |
| APP_ENV                | local                                               |
| APP_KEY                | base64:b2ZJKEHJN12vpByXYmTZtGJf5bOGgPUBWlVlIQEHm2A= |
| APP_DEBUG              | true                                                |
| APP_URL                | https://localhost                                   |

You may use the --resolve-references (or -r for short) flag to tell the command to resolve any references to other environment variables in the .env file.

Let's take a look at the following example .env file:

PUSHER_APP_KEY=abcdefghijklmnopqrstuvwxyz
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
$ php artisan env:list

+--------------------+----------------------------+
| Key                | Value                      |
+--------------------+----------------------------+
| PUSHER_APP_KEY     | abcdefghijklmnopqrstuvwxyz |
| MIX_PUSHER_APP_KEY | "${PUSHER_APP_KEY}"        |
+--------------------+----------------------------+

$ php artisan env:list --resolve-references

+--------------------+----------------------------+
| Key                | Value                      |
+--------------------+----------------------------+
| PUSHER_APP_KEY     | abcdefghijklmnopqrstuvwxyz |
| MIX_PUSHER_APP_KEY | abcdefghijklmnopqrstuvwxyz |
+--------------------+----------------------------+

Generate .env.example file

The env:example command may be used to generate a .env.example file from your current environment file. This "example" file will only contain keys, and all the values will be stripped.

$ php artisan env:example

You can specify a name to generate a different file:

$ php artisan env:example .env-example

Synchronize the .env file with .env.example

To add keys that are present in .env.example, but are missing from .env to the .env file, use the env:sync command:

$ php artisan env:sync

This will make sure all keys from .env.example are present in the .env file. You may optionally specify the name of the "example" file to use:

$ php artisan env:sync .env-example

Inspiration

Inspiration for this package came from LeShadow's ArtisanExtended.

Contributing

All contributions (pull requests, issues and feature requests) are welcome. Make sure to read through the CONTRIBUTING.md first, though. See the contributors page for all contributors.

License

sven/flex-env is licensed under the MIT License (MIT). See the license file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].