diff --git a/README.md b/README.md index 266399b..b27ecb3 100644 --- a/README.md +++ b/README.md @@ -6,20 +6,22 @@ This came about because I was thinking of how I could find the base directory of I wanted to find a way to find the base directory of an app from a class. +At the moment it does not work if the path is a symlink. + ## Usage ```php use Sikofitt\Retrorsum\Finder; -$finder = new Finder('composer.json'); +$finder = new Finder('autoload.php'); -define('BASE_DIR', (string)$finder); +define('BASE_DIR', dirname((string)$finder)); ``` or ```php -define('BASE_DIR', (string)(new Finder('composer.json'))); +define('BASE_DIR', dirname((string)(new Finder('composer.json')))); ``` Although this could set BASE_DIR as an empty string if it found nothing. @@ -28,7 +30,7 @@ Although this could set BASE_DIR as an empty string if it found nothing. $finder = new Finder('composer.json'); if(true === $finder->isFound()) { - define('BASE_DIR', $finder->getPath()); + define('BASE_DIR', dirname($finder->getPath())); } else { // Whatever your other method would be. }