-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem?
AssetPathResolver may improve with this method.
use Composer\Autoload\ClassLoader;
use ReflectionClass;
/**
* @throws \RuntimeException
*/
public static function getVendorPath(): string
{
$reflector = new ReflectionClass(ClassLoader::class);
$classLoaderPath = $reflector->getFileName();
if ($classLoaderPath === false) {
throw new \RuntimeException('Unable to find Composer ClassLoader file.');
}
$vendorPath = dirname($classLoaderPath, 2);
if (!is_dir($vendorPath)) {
throw new \RuntimeException('Unable to detect vendor path.');
}
return $vendorPath;
}Describe the desired solution
Use the above method.
Describe the alternatives that you have considered
https://github.com/szepeviktor/package-path/blob/master/src/PackagePath.php#L38
Additional context
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Labels
enhancementNew feature or requestNew feature or request