zippovich2 / wordpress-loader
Loading constants and environment variables from .env files.
Installs: 1 137
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: ^7.2.5 || ^8.0.0
- symfony/dotenv: ^5.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpunit/phpunit: ^8.5 || 9.0
This package is auto-updated.
Last update: 2024-10-16 15:42:25 UTC
README
Loading constants and environment variables from .env files.
Installation
Requirements:
- php ^7.2.5
$ composer require zippovich2/wordpress-loader
Usage
Add code at beginning in wp-config.php
:
use WordpressWrapper\Loader\Loader; //... $loader = new Loader(); $loader->load();
You can specify own paths:
use WordpressWrapper\Loader\Loader; //... $projectRoot = '/path/to/project-root/'; // this directory should containt .env files. $public = $projectRoot . '/public'; // this directory should containt index.php file $wpCore = '/wp'; // relevant path from $public to wordpress core directory $loader = new Loader(); $loader->load($wpCore, $projectRoot, $public);
If you want to enable debug add one more line:
use WordpressWrapper\Loader\Loader; //... $loader = new Loader(); $loader->load(); // default path is '/var/log', relevant ro project root // it will create directroy if not exists $loader->debugSettings('/path/to/log/dir');