当前位置: 首页>>代码示例>>PHP>>正文


PHP Dotenv::load方法代码示例

本文整理汇总了PHP中Dotenv\Dotenv::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Dotenv::load方法的具体用法?PHP Dotenv::load怎么用?PHP Dotenv::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dotenv\Dotenv的用法示例。


在下文中一共展示了Dotenv::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: loadEnv

 /**
  * Use Dotenv to set required environment variables from .env file in root
  */
 protected function loadEnv()
 {
     try {
         $this->dotenv->load();
         $this->dotenv->required($this->required);
     } catch (\InvalidArgumentException $e) {
         // Assuming env data is set by server
     }
 }
开发者ID:mrgrain,项目名称:autobahn-config,代码行数:12,代码来源:WordPress.php

示例3: __construct

 /**
  * HttpHelper constructor.
  */
 public function __construct()
 {
     $this->guzzle = new Client();
     $dotenv = new Dotenv(__DIR__ . '/../');
     $dotenv->load();
     $dotenv->required(['API_USERNAME', 'API_PASSWORD', 'SONAR_URL'])->notEmpty();
 }
开发者ID:sonarsoftware,项目名称:customer_portal_framework,代码行数:10,代码来源:HttpHelper.php

示例4: loadenv

 /**
  * load environment parameters
  * @return resource
  */
 public static function loadenv()
 {
     if (!getenv('APP_ENV') == 'production') {
         $dotenv = new Dotenv($_SERVER['DOCUMENT_ROOT']);
         $dotenv->load();
     }
 }
开发者ID:andela-sakande,项目名称:9jamoji,代码行数:11,代码来源:Config.php

示例5: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     if (file_exists(__DIR__ . '/../.env')) {
         $dotenv = new Dotenv(__DIR__ . '/../');
         $dotenv->load();
     }
 }
开发者ID:TijmenWierenga,项目名称:LaravelChargebee,代码行数:7,代码来源:BillableTest.php

示例6: setUp

 public function setUp()
 {
     $dotenv = new Dotenv(__DIR__ . '/../');
     $dotenv->load();
     $this->guzzle = m::mock(Client::class);
     $this->endpoint = getenv('MAILCHIMP_ENDPOINT');
 }
开发者ID:warksit,项目名称:laravel-mail-chimp-sync,代码行数:7,代码来源:TestCase.php

示例7: loadDotEnv

 private function loadDotEnv()
 {
     if (getenv("APP_ENV") !== "production") {
         $dotenv = new Dotenv(__DIR__ . "/..");
         $dotenv->load();
     }
 }
开发者ID:andela-kerinoso,项目名称:adhan-bot,代码行数:7,代码来源:AdhanBot.php

示例8: loadEnv

 /**
  * Load Dotenv to grant getenv() access to environment variables in .env file.
  */
 public function loadEnv()
 {
     if (!getenv('APP_ENV')) {
         $dotenv = new Dotenv(__DIR__ . '/../');
         $dotenv->load();
     }
 }
开发者ID:unicodeveloper,项目名称:jusibe-php-lib,代码行数:10,代码来源:Helper.php

示例9: setUp

 protected function setUp()
 {
     parent::setUp();
     file_put_contents(__DIR__ . '/../fixtures/data/.env', "test=test\ntestTrue=true\ntestFalse=false\ntestNull=null\ntestEmpty");
     $dotenv = new Dotenv(__DIR__ . '/../fixtures/data/');
     $dotenv->load();
 }
开发者ID:pana1990,项目名称:yii2-app,代码行数:7,代码来源:EnvTest.php

示例10: loadenv

 /**
  * use vlucas dotenv to access the .env file
  **/
 public static function loadenv()
 {
     if (getenv('APP_ENV') !== 'production') {
         $dotenv = new Dotenv(__DIR__);
         $dotenv->load();
     }
 }
开发者ID:andela-fokosun,项目名称:Checkpoint3,代码行数:10,代码来源:Config.php

示例11: loadDotenv

 /**
  * use vlucas dotenv to access the .env file
  **/
 protected function loadDotenv()
 {
     if (getenv('APP_ENV') !== 'production') {
         $dotenv = new Dotenv(__DIR__);
         $dotenv->load();
     }
 }
开发者ID:andela-fokosun,项目名称:Checkpoint2,代码行数:10,代码来源:Connection.php

示例12: createDatabase

 protected static function createDatabase()
 {
     if (empty(getenv('PGSQL_HOST')) && file_exists(__DIR__ . '/../../.env')) {
         $dotenv = new Dotenv(__DIR__ . '/../../');
         $dotenv->load();
     }
     if (empty(getenv('PGSQL_HOST')) || empty(getenv('PGSQL_USER'))) {
         throw new \RuntimeException('Create a .env file with PGSQL_HOST, PGSQL_USER, and PGSQL_PASS to run this test.');
     }
     $pass = getenv('PGSQL_PASS') ? getenv('PGSQL_PASS') : '';
     $pdo = new \PDO('pgsql:host=' . getenv('PGSQL_HOST'), getenv('PGSQL_USER'), $pass);
     $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
     self::$connection = DriverManager::getConnection(['driver' => 'pdo_pgsql', 'pdo' => $pdo, 'dbname' => 'public']);
     self::$connection->query('drop schema public cascade');
     self::$connection->query('create schema public');
     self::$connection->query('CREATE TABLE extended_data_objects (
       id SERIAL PRIMARY KEY,
       "isDeleted" BOOLEAN NOT NULL DEFAULT FALSE,
       "myColumn" VARCHAR(255) NOT NULL,
       "myNullableColumn" INT NULL DEFAULT NULL,
       "otherDataObjectId" INT NULL
     )');
     self::$connection->query('CREATE TABLE other_data_objects (
       id SERIAL PRIMARY KEY,
       "isDeleted" BOOLEAN NOT NULL DEFAULT FALSE,
       "name" VARCHAR(255) NOT NULL,
       "extendedDataObjectId" INT NULL REFERENCES extended_data_objects (id)
     )');
     self::$connection->query('CREATE TABLE extended_other_rel (
       "extendedDataObjectId" INT NOT NULL REFERENCES extended_data_objects (id),
       "otherDataObjectId" INT NOT NULL REFERENCES other_data_objects (id)
     )');
 }
开发者ID:thewunder,项目名称:corma,代码行数:33,代码来源:PostgresIntegrationTest.php

示例13: __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

示例14: setUp

 protected function setUp()
 {
     $dotenv = new Dotenv(__DIR__ . '/../');
     $dotenv->load();
     $uri = getenv('DATABASE_SERVER');
     $this->client = new Client(['base_uri' => "http://" . $uri]);
 }
开发者ID:andela-sachungo,项目名称:php-checkpoints,代码行数:7,代码来源:RouteTest.php

示例15: __construct

 public function __construct()
 {
     $dotenv = new Dotenv(__DIR__ . "/../");
     $dotenv->load();
     $dotenv->required("MYSQL_PASSWORD");
     $this->climate = new CLImate();
 }
开发者ID:sonarsoftware,项目名称:freeradius_genie,代码行数:7,代码来源:Genie.php


注:本文中的Dotenv\Dotenv::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。