nacosvel/package

A small utility library for handling metadata parsing and expansion.

dev-main / 1.x-dev 2024-09-22 12:40 UTC

This package is auto-updated.

Last update: 2024-11-22 13:08:21 UTC


README

A small utility library for handling metadata parsing and expansion.

GitHub Tag Total Downloads Packagist Version Packagist PHP Version Support Packagist License

Installation

You can install the package via Composer:

composer require nacosvel/package

Interface Reference

Nacosvel\Package\Contracts\PackageInterface

  • getRootPath(string $path = null): string;
  • setRootPath(string $rootPath): static;
  • getVendorPath(string $path = null): string;
  • setVendorPath(string $vendorPath): static;
  • combinePaths(string $basePath, string $relativePath): string;

Nacosvel\Package\Contracts\PackageManifestInterface

  • getManifest(string $namespace = null, string ...$args): mixed;
  • getPackageManifest(string ...$args): mixed;
  • getInstallPath(string $packageName): ?string;
  • getInstalledPackages(): array;

Quick Examples

$package = new \Nacosvel\Package\PackageManifest();

$package->getRootPath();
$package->getRootPath('composer.json');
$package->getVendorPath();
$package->getVendorPath('composer/installed.json');

$package->getManifest('psr/log', 'extra', 'branch-alias', 'dev-master');
$package->getPackageManifest('name');

$package->getInstalledPackages();
$package->getInstallPath('psr/log');

License

Nacosvel Package is made available under the MIT License (MIT). Please see License File for more information.