class PackageManifest

Properties

Filesystem $files

The filesystem instance.

string $basePath

The base path.

string $vendorPath

The vendor path.

string|null $manifestPath

The manifest path.

array|null $manifest

The loaded manifest array (filtered by runtime ignore list).

protected array|null $rawManifest

The raw manifest loaded from cache or built from installed.json.

static protected array<int, string> $packagesToIgnore

Packages that should be ignored during discovery.

Methods

__construct(Filesystem $files, string $basePath, string|null $manifestPath)

Create a new package manifest instance.

array
providers()

Get all of the service provider class names for all packages.

array
aliases()

Get all of the aliases for all packages.

array
config(string $key)

Get all of the values for all packages for the given configuration name.

string|null
version(string $package)

Get the cached version string for a package.

bool
hasPackage(string $package)

Determine if the given package is installed.

bool
satisfies(string $package, string $constraint)

Determine if a package satisfies a version constraint.

array
getManifest()

Get the current package manifest.

static array
discoverInstalledPackages(Filesystem $files, string $vendorPath, array $baseIgnore)

Discover installed Hypervel package metadata.

void
build()

Build the manifest and write it to disk.

string
format(string $package)

Format the given package name.

static string
formatPackageName(string $package, string $vendorPath)

Format the given package name with the given vendor path.

static array
packagesToIgnoreFromComposer(Filesystem $files, string $basePath)

Get the package names ignored by root composer metadata.

static mixed
rootHypervelExtra(Filesystem $files, string $basePath, string $key)

Get a root Composer extra.hypervel value.

array
packagesToIgnore()

Get the package names that should be ignored during build.

static void
ignorePackageDiscoveriesFrom(array $packages)

Set packages that should be ignored during discovery.

void
write(array $manifest)

Write the given manifest array to disk.

static void
flushState()

Flush all static state.

Details

at line 62
__construct(Filesystem $files, string $basePath, string|null $manifestPath)

Create a new package manifest instance.

Parameters

Filesystem $files
string $basePath
string|null $manifestPath

at line 73
array providers()

Get all of the service provider class names for all packages.

Return Value

array

at line 81
array aliases()

Get all of the aliases for all packages.

Return Value

array

at line 89
array config(string $key)

Get all of the values for all packages for the given configuration name.

Parameters

string $key

Return Value

array

at line 104
string|null version(string $package)

Get the cached version string for a package.

Returns the version from the manifest cache, avoiding runtime Composer API calls. Useful for feature gating and compatibility checks in application and package code.

Parameters

string $package

Return Value

string|null

at line 114
bool hasPackage(string $package)

Determine if the given package is installed.

Parameters

string $package

Return Value

bool

at line 130
bool satisfies(string $package, string $constraint)

Determine if a package satisfies a version constraint.

Uses Composer's semver constraint parser for full constraint support (e.g., "^2.0", ">=1.5 <3.0", "~4.1").

Requires composer/semver package. Add it to your project: composer require composer/semver

Parameters

string $package
string $constraint

Return Value

bool

Exceptions

RuntimeException

at line 158
protected array getManifest()

Get the current package manifest.

The raw manifest is cached from disk/build. The runtime ignore list (from ignorePackageDiscoveriesFrom) is applied on every call, so filtering works correctly even when the ignore list changes after the manifest was first loaded (e.g., in test suites).

Return Value

array

at line 190
static array discoverInstalledPackages(Filesystem $files, string $vendorPath, array $baseIgnore)

Discover installed Hypervel package metadata.

Parameters

Filesystem $files
string $vendorPath
array $baseIgnore

Return Value

array

at line 231
void build()

Build the manifest and write it to disk.

Return Value

void

at line 248
protected string format(string $package)

Format the given package name.

Parameters

string $package

Return Value

string

at line 256
static protected string formatPackageName(string $package, string $vendorPath)

Format the given package name with the given vendor path.

Parameters

string $package
string $vendorPath

Return Value

string

at line 266
static array packagesToIgnoreFromComposer(Filesystem $files, string $basePath)

Get the package names ignored by root composer metadata.

Parameters

Filesystem $files
string $basePath

Return Value

array

at line 276
static mixed rootHypervelExtra(Filesystem $files, string $basePath, string $key)

Get a root Composer extra.hypervel value.

Parameters

Filesystem $files
string $basePath
string $key

Return Value

mixed

at line 306
protected array packagesToIgnore()

Get the package names that should be ignored during build.

Only includes project-level dont-discover from composer.json. Runtime ignores (from ignorePackageDiscoveriesFrom) are applied at read time in getManifest(), not at build time.

Return Value

array

at line 323
static void ignorePackageDiscoveriesFrom(array $packages)

Set packages that should be ignored during discovery.

Used by testbench to suppress package discovery at runtime without modifying the project's composer.json.

Boot or tests only. The list persists in a static property used during package discovery; runtime use has no effect on already-discovered providers.

Parameters

array $packages

Return Value

void

at line 333
protected void write(array $manifest)

Write the given manifest array to disk.

Parameters

array $manifest

Return Value

void

Exceptions

Exception

at line 348
static void flushState()

Flush all static state.

Return Value

void