Giter Club home page Giter Club logo

phpdotenv-vault's People

Contributors

motdotla avatar nsnguyen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

phpdotenv-vault's Issues

DotEnv Methods not callable

Hi,

it is not possible to call phpdotenv methods like:

$dotenv = DotenvVault::createImmutable(__DIR__, '.env.vault');
$dotenv->load();

$dotenv->required('DATABASE_DSN');

Throws:
Repository is not set

Solution:

public function __construct(
StoreInterface $store,
ParserInterface $parser,
LoaderInterface $loader,
RepositoryInterface $repository
)
{
$this->store = $store;
$this->parser = $parser;
$this->loader = $loader;
$this->repository = $repository;
}

should be:

public function __construct(
        StoreInterface $store,
        ParserInterface $parser,
        LoaderInterface $loader,
        RepositoryInterface $repository
    )
    {
        $this->store = $store;
        $this->parser = $parser;
        $this->loader = $loader;
        $this->repository = $repository;
        parent::__construct($store, $parser, $loader, $repository);
    }

Load fallback .env prints first entry

Hi,

if there is no DOTENV_KEY phpdotenv-vault fallback to the unencrypted .env file.
In this case there is a var_dump on first .env entry (ref)

var_dump($entries[0]->getName());
var_dump($entries[0]->getValue());

If there should be an output, it would be better to add a notice or warning so that it can be ignored by error_reporting.

trigger_error('Fallback to unencrypted .env', E_USER_NOTICE);

NOT_FOUND_DOTENV_ENVIRONMENT in version 0.1.2

Hi,

after updating to package version 0.1.2, phpdotenv-vault throws:
NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment DOTENV_VAULT_DEVELOPMENT in your .env.vault file. Run 'npx dotenv-vault build' to include it.

PHP: 8.2
phpdotenv-vault: 0.1.2

In my opinion the problem is, the last change Use getenv instead of

Why?
We load our .env with the following code:

$dotenv = DotenvVault::createImmutable(__DIR__, '.env.vault');
$dotenv->load();

The function createImmutable calls RepositoryBuilder::createWithDefaultAdapters(). The used default adapters are ServerConstAdapter and EnvConstAdapter (ref vlucas/phpdotenv/src/Repository/RepositoryBuilder.php).
These adapters write our environment variables to $_SERVER and $_ENV. So with these adapers we can't access our variables via getenv. The needed PutenvAdapter is only added inside createUnsafeImmutable.

How to deal with it?

PHPStan: Class DotenvVault\\DotEnvVault referenced with incorrect case: DotenvVault\\DotenvVault

Hi,

the class name is written in CamelCase so the current readme example:

use DotenvVault\DotenvVault;
require 'vendor/autoload.php';
$dotenv = DotenvVault::createImmutable(__DIR__, '.env.vault');
$dotenv->load(); # take environment variables from .env.vault

Should be look like:

use DotenvVault\DotEnvVault; 
require 'vendor/autoload.php'; 
  
$dotenv = DotEnvVault::createImmutable(__DIR__, '.env.vault'); 
$dotenv->load(); # take environment variables from .env.vault 

Why npx?

Writing a library for PHP but requiring Node.Js (The NPX)? Why not using PHP's in built system?

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.