I'm writing a php library for managing configurations of an application.
but the problem is anyone who uses my library will store their configuration files in ./config
folder of their project root directory.
e.g. var/www/example.com/config/site.php
and my library is installed in a sub directory of the project
i.e vendor/azi/config/src/Config.php
To Load files from project root i am doing it this way
if (!defined('PATH_TO_CONFIG_DIR')) {
define('PATH_TO_CONFIG_DIR', dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/config/");
}
is it right ? Or It can be more efficient. Code suggestion will be helpful.