Update readme
This commit is contained in:
parent
4b632ba7ba
commit
d13c79f00f
10
README.md
10
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.
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue