2017 © Pedro Peláez
 

library retrorsum

Finds a file searching recursively from the current directory.

image

sikofitt/retrorsum

Finds a file searching recursively from the current directory.

  • Friday, February 3, 2017
  • by sikofitt
  • Repository
  • 1 Watchers
  • 1 Stars
  • 9 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Retrorsum

This is a simple thing that will search for a file traversing down from the current directory., (*1)

This came about because I was thinking of how I could find the base directory of a project without guessing with __DIR__."/../../../" and without forcing an app/ directory or something., (*2)

I wanted to find a way to find the base directory of an app from a class., (*3)

At the moment it does not work if the path is a symlink., (*4)

Usage

use Sikofitt\Retrorsum\Finder;

$finder = new Finder('autoload.php');

define('BASE_DIR', dirname((string)$finder));

or, (*5)

define('BASE_DIR', dirname((string)(new Finder('autoload.php'))));

Although this could set BASE_DIR as an empty string if it found nothing., (*6)

$finder = new Finder('autoload.php');
if(true === $finder->isFound())
{
    define('BASE_DIR', dirname($finder->getPath()));
} else {
   // Whatever your other method would be.
}

License

GPL-3.0, (*7)

The Versions

03/02 2017

v1.x-dev

1.9999999.9999999.9999999-dev https://github.com/sikofitt/retrorsum

Finds a file searching recursively from the current directory.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.6

 

The Development Requires

by Avatar sikofitt

file search reverse find

03/02 2017

dev-master

9999999-dev https://github.com/sikofitt/retrorsum

Finds a file searching recursively from the current directory.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.6

 

The Development Requires

by Avatar sikofitt

file search reverse find

03/02 2017

v1.0.0

1.0.0.0 https://github.com/sikofitt/retrorsum

Finds a file searching recursively from the current directory.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.6

 

The Development Requires

by Avatar sikofitt

file search reverse find