nathanwooten / pathfind
An easy pathfinder.
Installs: 17
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/nathanwooten/pathfind
Requires
- php: ^7.3
README
Find a path up in the structure, based on contents.
<?php // entry-point/index.php require dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'bootstrap.php'; $pathFind = $pathFind->withPath( parse_url( $_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH ) ); $pathFind = $pathFind->withContains( [ 'header.php' ] ); require $pathFind . DS . 'header.php'; // your app $pathFind = $pathFind->withContains( [ 'footer.php' ] ); require $pathFind . DS . 'footer.php';
<?php // bootstrap.php, this is loaded before pathFind is used in the index file require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'PathFind.php'; $pathFind = new PathFind; $pathFind->pathFind( __FILE__, [ 'public_html' ] ) . DS . 'main' . DS . 'lib.php';