本文整理汇总了PHP中Dotenv\Dotenv类的典型用法代码示例。如果您正苦于以下问题:PHP Dotenv类的具体用法?PHP Dotenv怎么用?PHP Dotenv使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Dotenv类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: _setEnv
/**
* Set the environment variables.
*
* @return array|bool
*/
private function _setEnv()
{
if (!file_exists(base_path('.env'))) {
return false;
}
$env = new Dotenv(base_path());
return $env->load();
}
开发者ID:phireframework,项目名称:support,代码行数:13,代码来源:Application.php
示例17: setUp
public function setUp()
{
$dotenv = new Dotenv(__DIR__ . '/../');
$dotenv->load();
if ($_ENV['COINFIDE_USER'] == 'yourapiusername') {
die('Please copy .env.example file to .env and fill in your Coinfide credentials');
}
}
开发者ID:coinfide,项目名称:php-sdk,代码行数:8,代码来源:BaseTest.php
示例18: testArrayInstantiation
public function testArrayInstantiation()
{
$dotEnv = new Dotenv('./');
$dotEnv->load();
$data = ['username' => getenv('CARAVANA_USERNAME'), 'password' => getenv('CARAVANA_PASSWORD'), 'clientId' => getenv('CARAVANA_CLIENT_ID'), 'clientSecret' => getenv('CARAVANA_CLIENT_SECRET'), 'grantType' => getenv('CARAVANA_GRANT_TYPE'), 'accessToken' => getenv('CARAVANA_ACCESS_TOKEN'), 'authEndPoint' => getenv('CARAVANA_AUTH_ENDPOINT'), 'apiEndPoint' => getenv('CARAVANA_API_ENDPOINT')];
$api = new Api($data);
$this->assertInstanceOf('Caravana\\API\\Api', $api);
}
开发者ID:caravanarentals,项目名称:base-php-wrapper,代码行数:8,代码来源:AccessTokenTest.php
示例19: start
function start()
{
// Load .env to be able to access configuration variables
$dotenv = new Dotenv(__DIR__);
$dotenv->load();
$wolf = new Slackwolf(getenv('BOT_TOKEN'));
$wolf->run();
}
开发者ID:stevenspasbo,项目名称:slackwolf,代码行数:8,代码来源:bot.php
示例20: load
public static function load()
{
if (!getenv('APP_ENV') || getenv('APP_ENV') == "local") {
// load config values from .env file if APP_ENV is not found.
// APP_ENV is set on Heroku server
$dotenv = new Dotenv($_SERVER['DOCUMENT_ROOT']);
$dotenv->load();
}
}
开发者ID:andela-womokoro,项目名称:naija_emojis,代码行数:9,代码来源:Configuration.php
注:本文中的Dotenv\Dotenv类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论