Test file and update README

2.x 1.0.0
Julien Rosset 4 years ago
parent 5b3260e669
commit a2565e945f

@ -13,5 +13,16 @@ composer require jrosset/envreader
```php ```php
<?php <?php
use jrosset\EnvReader\BaseEnv;
class Env extends BaseEnv {
protected const PATH_ENV = __DIR__ . '/.env';
protected function initProperties (): array {
return [
'WEBSITE_MODE' => 'DEV',
'WEBSITE_NAME' => 'Generic site'
];
}
}
``` ```

@ -0,0 +1,5 @@
WEBSITE_NAME=Foo
DB_NAME=Bar
DB_LOGIN=Bar
DB_PASS=*****

@ -0,0 +1,23 @@
<?php
/** @noinspection PhpIllegalPsrClassPathInspection */
require_once __DIR__ . '/../vendor/autoload.php';
use jrosset\EnvReader\BaseEnv;
class Env extends BaseEnv {
/**
* @inheritdoc
*/
protected const PATH_ENV = __DIR__ . '/.env';
protected function initProperties (): array {
return [
'WEBSITE_MODE' => 'DEV',
'WEBSITE_NAME' => 'Generic site',
];
}
}
var_dump(Env::getInstance()->getProperties());
var_dump(Env::getInstance()->getProperty('db_host', 'localhost'));
Loading…
Cancel
Save