class PackageManifest extends PackageManifest

Properties

Filesystem $files

The filesystem instance.

from  PackageManifest
string $basePath

The base path.

from  PackageManifest
string $vendorPath

The vendor path.

from  PackageManifest
string|null $manifestPath

The manifest path.

from  PackageManifest
array|null $manifest

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

from  PackageManifest
protected array|null $rawManifest

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

from  PackageManifest
static protected array<int, string> $packagesToIgnore

Packages that should be ignored during discovery.

from  PackageManifest
protected object|null $testbench

The current testbench instance.

protected array<int, string> $requiredPackages

Packages that must remain discoverable when discovery is disabled.

protected null|array<string, array<string, mixed>> $rootManifest

The package's own manifest entry, keyed by its package name.

Methods

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

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.

array
prepareManifest(array $manifest)

Prepare a built or cached manifest before it is stored or used.

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 string
packageName(array $package, string $location, string $vendorPath)

Get the formatted package name from Composer metadata.

static array
hypervelExtra(array $package, string $location)

Get the Hypervel configuration from Composer metadata.

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 packages that should be ignored during manifest 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.

static void
swap(Application $app, object|null $testbench = null)

Swap the application binding to the Testbench package manifest.

void
setTestbench(object|null $testbench)

Set the current testbench instance.

requires(string ...$packages)

Require packages even when discovery is disabled.

string|null
getManifestPath()

Get the manifest path.

bool
discoversRootPackage()

Determine if the manifest includes the package's own Composer metadata.

static bool
discoversRootPackageAt(string $basePath, bool $optedIn = false)

Determine if a manifest for the given base path includes the package's own Composer metadata.

array
providersFromRoot()

Get the root package discovery configuration.

array|null
providersFromTestbench()

Get the root package composer metadata.

Details

at line 46
__construct(Filesystem $files, string $basePath, string|null $manifestPath, object|null $testbench = null)

Create a new package manifest instance.

Parameters

Filesystem $files
string $basePath
string|null $manifestPath
object|null $testbench

in PackageManifest at line 76
array providers()

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

Return Value

array

in PackageManifest at line 84
array aliases()

Get all of the aliases for all packages.

Return Value

array

in PackageManifest at line 92
array config(string $key)

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

Parameters

string $key

Return Value

array

in PackageManifest at line 107
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

in PackageManifest at line 117
bool hasPackage(string $package)

Determine if the given package is installed.

Parameters

string $package

Return Value

bool

in PackageManifest at line 133
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 147
protected array getManifest()

Get the current package manifest.

Return Value

array

in PackageManifest at line 201
static array discoverInstalledPackages(Filesystem $files, string $vendorPath, array $baseIgnore)

Discover installed Hypervel package metadata.

Parameters

Filesystem $files
string $vendorPath
array $baseIgnore

Return Value

array

in PackageManifest at line 276
void build()

Build the manifest and write it to disk.

Return Value

void

at line 238
protected array prepareManifest(array $manifest)

Prepare a built or cached manifest before it is stored or used.

Parameters

array $manifest

Return Value

array

in PackageManifest at line 304
protected string format(string $package)

Format the given package name.

Parameters

string $package

Return Value

string

in PackageManifest at line 312
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

in PackageManifest at line 320
static protected string packageName(array $package, string $location, string $vendorPath)

Get the formatted package name from Composer metadata.

Parameters

array $package
string $location
string $vendorPath

Return Value

string

in PackageManifest at line 342
static protected array hypervelExtra(array $package, string $location)

Get the Hypervel configuration from Composer metadata.

Parameters

array $package
string $location

Return Value

array

in PackageManifest at line 364
static array packagesToIgnoreFromComposer(Filesystem $files, string $basePath)

Get the package names ignored by root composer metadata.

Parameters

Filesystem $files
string $basePath

Return Value

array

in PackageManifest at line 374
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 177
protected array packagesToIgnore()

Get the packages that should be ignored during manifest build.

Return Value

array

in PackageManifest at line 416
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.

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

in PackageManifest at line 427
protected void write(array $manifest)

Write the given manifest array to disk.

Parameters

array $manifest

Return Value

void

Exceptions

Exception

in PackageManifest at line 442
static void flushState()

Flush all static state.

Return Value

void

at line 65
static void swap(Application $app, object|null $testbench = null)

Swap the application binding to the Testbench package manifest.

Parameters

Application $app
object|null $testbench

Return Value

void

at line 84
void setTestbench(object|null $testbench)

Set the current testbench instance.

Parameters

object|null $testbench

Return Value

void

at line 94
PackageManifest requires(string ...$packages)

Require packages even when discovery is disabled.

Parameters

string ...$packages

Return Value

PackageManifest

at line 106
string|null getManifestPath()

Get the manifest path.

Return Value

string|null

at line 114
bool discoversRootPackage()

Determine if the manifest includes the package's own Composer metadata.

Return Value

bool

at line 130
static bool discoversRootPackageAt(string $basePath, bool $optedIn = false)

Determine if a manifest for the given base path includes the package's own Composer metadata.

Remote commands can start before an application exists, so the decision is also available without a manifest instance.

Parameters

string $basePath
bool $optedIn

Return Value

bool

at line 188
protected array providersFromRoot()

Get the root package discovery configuration.

Return Value

array

at line 220
protected array|null providersFromTestbench()

Get the root package composer metadata.

Return Value

array|null