当前位置: 首页>>代码示例>>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;未经允许,请勿转载。