doLoad example

/** * Loads one or several .env files. * * @param string $path A file to load * @param string ...$extraPaths A list of additional files to load * * @throws FormatException when a file has a syntax error * @throws PathException when a file does not exist or is not readable */
    public function load(string $path, string ...$extraPaths): void
    {
        $this->doLoad(false, \func_get_args());
    }

    /** * Loads a .env file and the corresponding .env.local, .env.$env and .env.$env.local files if they exist. * * .env.local is always ignored in test env because tests should produce the same results for everyone. * .env.dist is loaded when it exists and .env is not found. * * @param string $path A file to load * @param string|null $envKey The name of the env vars that defines the app env * @param string $defaultEnv The app env to use when none is defined * @param array $testEnvs A list of app envs for which .env.local should be ignored * * @throws FormatException when a file has a syntax error * @throws PathException when a file does not exist or is not readable */

    public function has($name)
    {
        $fallbackName = $name;
        $name = $this->getNormalizedId($name);

        return isset($this->services[$name]) || $this->doLoad($name$fallbackName);
    }

    /** * Checks if the given resource name is already registered. * Unlike as the hasResource method is, if the resource does not exist the resource will not even loaded. * * @param string $name * * @return bool */
    public function initialized($name)
    {
Home | Imprint | This part of the site doesn't use cookies.