當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Dotenv::overload方法代碼示例

本文整理匯總了PHP中Dotenv\Dotenv::overload方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dotenv::overload方法的具體用法?PHP Dotenv::overload怎麽用?PHP Dotenv::overload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Dotenv\Dotenv的用法示例。


在下文中一共展示了Dotenv::overload方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: parseEnvironmentVariables

 /**
  * Parses environment file
  */
 protected function parseEnvironmentVariables()
 {
     if ($this->allowOverloading) {
         $this->dotEnv->overload();
     } else {
         $this->dotEnv->load();
     }
 }
開發者ID:helhum,項目名稱:dotenv-connector,代碼行數:11,代碼來源:DotEnvReader.php

示例2: __invoke

 /**
  * Update wp-cli.yml with settings from .env files
  *
  * ## OPTIONS
  *
  * <environment>
  * : The name of the environment to set. Typically matched by a .env-<environemnt> file in the project root
  *
  * @param $args
  * @param $assocArgs
  *
  * @when before_wp_load
  */
 public function __invoke($args, $assocArgs)
 {
     $environment = $args[0];
     if (file_exists(WPBOOT_BASEPATH . "/.env")) {
         $dotEnv = new Dotenv(WPBOOT_BASEPATH);
         $dotEnv->load();
     }
     $file = '.env-' . $environment;
     if (file_exists(WPBOOT_BASEPATH . "/{$file}")) {
         $dotEnv = new Dotenv(WPBOOT_BASEPATH, $file);
         $dotEnv->overload();
     }
     try {
         $dotEnv = new Dotenv(__DIR__);
         $dotEnv->required('wppath');
     } catch (\Exception $e) {
         echo $e->getMessage() . "\n";
         return;
     }
     $runner = WP_CLI::get_runner();
     $ymlPath = $runner->project_config_path;
     $yaml = new Yaml();
     $config = $yaml->parse(file_get_contents($ymlPath));
     $config['path'] = $_ENV['wppath'];
     $config['environment'] = $environment;
     $dumper = new Dumper();
     file_put_contents($ymlPath, $dumper->dump($config, 2));
 }
開發者ID:eriktorsner,項目名稱:wp-bootstrap,代碼行數:41,代碼來源:SetEnv.php

示例3: register

 /**
  * Add the configuration from the environment to a container
  *
  * @param   Container $container The container
  * @param   string    $alias     An optional alias, defaults to 'config'
  *
  * @return  void
  */
 public function register(Container $container, $alias = 'config')
 {
     $file = '.env';
     if ($container->has('ConfigFileName')) {
         $file = $container->get('ConfigFileName');
     }
     $dotenv = new Dotenv($container->get('ConfigDirectory'), $file);
     $dotenv->overload();
     $container->set($alias, new Registry($_ENV), true);
 }
開發者ID:nibra,項目名稱:joomla-pythagoras,代碼行數:18,代碼來源:ConfigServiceProvider.php

示例4: readDotEnv

 /**
  * @param Container $pimple
  */
 private function readDotEnv(Container $pimple)
 {
     if (file_exists(WPBOOT_BASEPATH . "/.env")) {
         $dotEnv = new Dotenv(WPBOOT_BASEPATH);
         $dotEnv->load();
     }
     $file = '.env-' . $pimple['environment'];
     if (file_exists(WPBOOT_BASEPATH . "/{$file}")) {
         $dotEnv = new Dotenv(WPBOOT_BASEPATH, $file);
         $dotEnv->overload();
     }
 }
開發者ID:eriktorsner,項目名稱:wp-bootstrap,代碼行數:15,代碼來源:ApplicationParametersProvider.php

示例5: Forge

use Dotenv\Dotenv;
use Og\Kernel\Kernel;
include 'paths.php';
include SUPPORT . 'helpers.php';
include SUPPORT . 'messages.php';
include VENDOR . 'autoload.php';
/** @noinspection PhpUnusedLocalVariableInspection */
$forge = new Forge(new \Illuminate\Container\Container());
// register the Config
$forge->add(['config', Config::class], Config::createFromFolder(CONFIG));
// register the Kernel
$forge->singleton(['kernel', Kernel::class], new Kernel($forge));
// set the timezone (as required by earlier versions of PHP before 7.0.0
date_default_timezone_set($forge['config']['app.timezone']);
# load environment as a requirement
if (file_exists(ROOT . '.env')) {
    $dotenv = new Dotenv(ROOT);
    $dotenv->overload();
} else {
    throw new \LogicException('Unable to find root environment file. Did you remember to rename `.env-example?');
}
# install Tracy if in DEBUG mode
if (strtolower(getenv('DEBUG')) === 'true') {
    # core debug utilities
    # note that debug requires that the environment has been loaded
    include 'debug.php';
}
// register the application instance
$forge['app'] = function () use($forge) {
    return new Application($forge->make('kernel'));
};
開發者ID:anctemarry27,項目名稱:cogs,代碼行數:31,代碼來源:boot.php


注:本文中的Dotenv\Dotenv::overload方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。