GithubHelp home page GithubHelp logo

msztorc / laravel-env Goto Github PK

View Code? Open in Web Editor NEW
76.0 3.0 10.0 343 KB

Managing Laravel environment variables from the CLI

License: MIT License

PHP 100.00%
laravel env variables environment artisan php

laravel-env's People

Contributors

laravel-shift avatar msztorc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laravel-env's Issues

Fix/add support for setting empty string value

Whenever I try to set a value to an empty string, like this:

$env->setValue('MAIL_USERNAME', '');

I get the following exception:

ErrorException Uninitialized string offset: 0

Often time we need to set an value to empty string, so it will be helpful if this was fixed. I think a simple

if (empty($value)) {
}

check would be sufficient at the beginning of _prepareValue(); before we check the string index.
Thanks.

Forces page reload with axios request

Hi.

When using this package with vuejs 3 (Laravel 9 + Inertiajs + vue), on post of values to change and subsequent change of the values, a page refresh is always forced when the package is used. When turned off, everything works the way it should.

Could you please look into this?

Comments on .env

When comments are set on the .env (example)

# --------------------------------------------
# REQUIRED: BASIC APP SETTINGS
# --------------------------------------------

The library fails to identify them on the parse lines:

        foreach ($env_lines as $line) {
            if (strlen($line)) {
                [$key, $val] = explode('=', (string) $line);
                $this->_envVars[$key] = $this->_stripValue($val);
            }
        }

since there is no "$val"

setValue with value url will error

Problem
When you want to give the url value to the APP_URL key or another key with the url value the results in the env file will be different.

Example
For example, you want to fill in the value https://google.com but the result in env file will be https\://google.com.

Cause
Once I see in the code it is caused by return preg_quote($value); in line 143 of file Env.php.

My Temporary Solution
I change code from return preg_quote($value); to return $value;.

I'm sorry if my English is bad and this is the first issue I raise ๐Ÿ™

PHP 8 Support

Hey, do you plan php 8 support. Unfortunately I don't have php 7 anymore.

Thanks!

Dashes are being escaped

Hi, when trying to set env variable to a value with a dash, a slash will appear in front of the dash in the .env file.

i.e:
TEST_VAR=my\-test

Can you exclude the dash from being escaped?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.