Project root directory implementation in PHP
You can install the package via composer:
composer require ghostwriter/rootYou can also star (🌟) this repo to find it easier later.
use Ghostwriter\Root\AbstractRootDirectory;
$appRootDirectory = new readonly class('/tmp/app') extends AbstractRootDirectory {}
// returns the absolute path to the root directory
$appRootDirectory->toString(); // /tmp/app
// returns the absolute path to the src directory
$appRootDirectory->path('src'); // /tmp/app/src
// returns the absolute path to the src/Foo/Bar.php file
$appRootDirectory->path('src', 'Foo', 'Bar.php'); // /tmp/app/src/Foo/Bar.phpPlease see CHANGELOG.md for more information on what has changed recently.
Please see LICENSE for more information on the license that applies to this project.
Please see SECURITY.md for more information on security disclosure process.