Project root directory implementation in PHP

Maintainers

Package info

github.com/ghostwriter/root

pkg:composer/ghostwriter/root

Transparency log

Fund package maintenance!

ghostwriter

Paypal

Statistics

Installs: 78

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0 2026-07-13 17:02 UTC

This package is auto-updated.

Last update: 2026-07-13 17:05:27 UTC


README

Automation PHP Version Packagist Downloads PayPal Sponsors via GitHub

Project root directory implementation in PHP

Installation

You can install the package via composer:

composer require ghostwriter/root

Star ⭐️ this repo if you find it useful

You can also star (🌟) this repo to find it easier later.

Usage

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.php

Credits

Changelog

Please see CHANGELOG.md for more information on what has changed recently.

License

Please see LICENSE for more information on the license that applies to this project.

Security

Please see SECURITY.md for more information on security disclosure process.