konsulting/project-root
Resolve the correct root path when developing a Composer package or using it as a dependency. Project Root lets you target a package name and resolve paths relative to the host project, avoiding repeated “dirty” path-detection logic.
A simple package to help with resolving paths when working in a composer package.
Specifically, for some functionality you may need to refer to the packages root directory, but then need to use the project's root when the package is included as a dependency.
Rather than keep repeating dirty logic from before, we can use this package.
composer require konsulting/package-root
<?php
\Konsulting\ProjectRoot::forPackage('package-name')->resolve(__DIR__);
Contributions are welcome and will be fully credited. We will accept contributions by Pull Request.
Please:
We use PHPUnit
Run tests using PHPUnit: vendor/bin/phpunit
How can I help you explore Laravel packages today?