dotenv-org / phpdotenv-vault

Load environment variables from encrypted .env.vault files
https://www.dotenv.org/docs/languages/php
BSD 3-Clause "New" or "Revised" License
8 stars 3 forks source link

DotEnv Methods not callable #4

Closed SchoppAx closed 10 months ago

SchoppAx commented 1 year ago

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: https://github.com/dotenv-org/phpdotenv-vault/blob/61dbb12f3d360027092e36b6e42a388d1bae3cb4/src/DotenvVault.php#L24-L35 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);
    }