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


PHP Dotenv\Dotenv類代碼示例

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


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

示例1: loadDotEnv

 private function loadDotEnv()
 {
     if (getenv("APP_ENV") !== "production") {
         $dotenv = new Dotenv(__DIR__ . "/..");
         $dotenv->load();
     }
 }
開發者ID:andela-kerinoso,項目名稱:adhan-bot,代碼行數:7,代碼來源:AdhanBot.php

示例2: 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

示例3: 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

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

示例5: 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

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

示例7: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     if (file_exists(__DIR__ . '/../.env')) {
         $dotenv = new Dotenv(__DIR__ . '/../');
         $dotenv->load();
     }
 }
開發者ID:TijmenWierenga,項目名稱:LaravelChargebee,代碼行數:7,代碼來源:BillableTest.php

示例8: 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

示例9: __construct

 public function __construct(string $configDir = __DIR__ . '/../../../../../', bool $isSandbox = false, string $configFile = '.env')
 {
     $config = new Dotenv($configDir, $configFile);
     $config->load();
     $config->required(['YANDEX_LOGIN', 'DIRECT_API_TOKEN', 'DIRECT_API_MASTER_TOKEN', 'DIRECT_API_SANDBOX_MASTER_TOKEN', 'DIRECT_ACCEPT_LANGUAGE']);
     $this->sandbox = $isSandbox;
 }
開發者ID:perf2k2,項目名稱:direct,代碼行數:7,代碼來源:Connection.php

示例10: loadEnv

 /**
  * Load Dotenv to grant getenv() access to environment variables in .env file
  *
  * @return Values
  */
 protected static function loadEnv()
 {
     if (!getenv("APP_ENV")) {
         $dotenv = new Dotenv($_SERVER['DOCUMENT_ROOT']);
         $dotenv->load();
     }
 }
開發者ID:alexschwarz89,項目名稱:easy-mysqli-fulltext,代碼行數:12,代碼來源:Search.php

示例11: 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

示例12: 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

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

示例14: 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

示例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類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。