PackageManager
MMO\core · 1 symbol · generated 5 Oct 2026
PackageManager
PackageManager.php:41- Namespace
MMO\core- Extends
- aModule
Index
Properties9
compression
- Type
- int
discoverFolders
- Type
- array
manifests
- Type
- array
manifestUrls
- Type
- array
packagesFolder
- Type
- string
phar
- Type
- bool
project
projectManifest
- Type
- null | PackageManifest
urls
- Type
- array
Methods30
addUrl($name, $version, $url)
PackageManager.php:211Register one more place a package's manifest can be found (readManifest discovers these automatically from a manifest's own urls entry).
buildDependencies($dependencies, $folder, $name, $version, $options)
PackageManager.php:615Build all dependencies linked to a package
| $dependencies | array | |
| $folder | string | the folder to build the phar into (MUST end with '/') |
| $name | string | the name of the package |
| $version = '*' | string | the version to build |
| $options = [] | array | options passed to the package's hook and used to determine if a package needs to be built * if a package's namespace is a key, the boolean associated value force/prevent the build of the package * ex: $options['MMO\\core'] = false will prevent package mmo.core to be built |
| returns | void |
buildProject($manifest, $additionalPackages, $folder, $options)
PackageManager.php:641Build a project from a manifest
| $manifest | PackageManifest | string | if string, the filename of the manifest (eq: mmo.json) |
| $additionalPackages = [] | array | packages to add to the project, same format as \MMO\inc(): [package => version, ...] or [package, ...] (version defaults to '*', the latest) |
| $folder = null | null | string | the folder to build the packages into (if null use manifest folder ./packages ) |
| $options = [] | array | options to pass to the hook of each packages (WARNING: passed by reference) |
| returns | array | the list of packages and version built |
DefaultConfig()
staticPackageManager.php:72discoverUrls($folder, $depth)
PackageManager.php:180Discover url reading package*.phar and mmo.json
enablePhar($value)
PackageManager.php:138Enable phar packages
fetchBuild($filename, $name, $version, $options)
PackageManager.php:573Fetch a package or build it in the manifest folder and copy it to the destination
| $filename | string | the destination for the package |
| $name | string | the package's name |
| $version = '*' | string | the package's version |
| $options = [] | array | options passed to the package's hook and used to determine if a package needs to be built if a package's namespace is a key, the boolean associated value force/prevent the build of the package ex: $options['MMO\\core'] = false will prevent package mmo.core to be built |
| returns | string | the version fetched |
getCompression()
PackageManager.php:117| returns | int | the compression mode used when building .phar packages (a \Phar::* constant, e.g. \Phar::NONE/\Phar::GZ). |
getDependencies($name, $version, $packageVersions)
PackageManager.php:439Get the dependencies needed for a package
getManifest($name, $version)
PackageManager.php:340Get a manifest by name and version
| $name | string | |
| $version = '*' | string | |
| returns | null | PackageManifest |
getManifestByNamespace($ns, $version, $included)
PackageManager.php:393| $ns | string | must match exactly (unlike loopManifestByNamespace, no sub-namespace matching). |
| $version = null | null | string | |
| $included = true | null | bool | |
| returns | null | PackageManifest | the first exact match, or null. |
getManifests()
PackageManager.php:401| returns | array | name => [version => PackageManifest] every manifest read so far (readManifest). |
getProject()
PackageManager.php:163| returns | null | string | the project manifest's URL (setProject), or null if none is set. |
getProjectBuildFolder($manifest)
PackageManager.php:628| $manifest | PackageManifest | |
| returns | string | where $manifest's built .phar dependencies are placed ($packagesFolder, relative to the manifest's own folder). |
getProjectManifest()
PackageManager.php:168| returns | null | PackageManifest | the project's own manifest (setProject), or null if none is set. |
getUrl($name, $version)
PackageManager.php:226| $name | string | |
| $version = '*' | string | a version constraint (loopVersions). |
| returns | array | every URL registered for a version of $name matching $version, most recent matching version first. |
| throws | if $name is entirely unknown. |
getUrls()
PackageManager.php:206| returns | array | name => [version => [url, ...]] every known manifest URL, whether or not its manifest has actually been read yet. |
hasUrl($name)
PackageManager.php:216inc($name, $version)
PackageManager.php:485Include a package and every one of its (not-yet-included) dependencies, in dependency order: requires each one's bootstrap file and merges its returned configuration (mergeInject) into the shared Configuration, unless an Inc listener stops the event for it.
includedVersion($name, $versionConstraint)
PackageManager.php:408incVersion($manifest, $where, $inc, $save)
PackageManager.php:540Increment manifest version and update indexes
| $manifest | PackageManifest | |
| $where = MMO\core\versions\PATCH | int | |
| $inc = 1 | int | |
| $save = true | bool | |
| returns | string | the new version |
isIncluded($name, $versionConstraint)
PackageManager.php:416isPharEnabled()
PackageManager.php:129| returns | bool | whether .phar packages can be loaded (enablePhar) -- defaults to true outside dev mode, or when this project itself runs from a phar. |
loopIncluded()
PackageManager.php:421loopManifestByNamespace($ns, $version, $included)
PackageManager.php:377| $ns | string | a namespace prefix, e.g. 'MMO\core' (also matches sub-namespaces, e.g. 'MMO\core\server'). |
| $version = null | null | string | a version constraint, if only specific versions should match. |
| $included = null | null | bool | if given, only match manifests that are (or aren't) currently included (isIncluded). |
| returns | Generator | every matching manifest. |
loopManifestByVersions($name, $versionConstraint)
PackageManager.php:328Tells if a manifest exists and returns its version
| $name | string | |
| $versionConstraint = '*' | string | a constraint on the version to look for |
| returns | Generator | ($version => $manifest), most recent matching version first, among already-read manifests only (readManifest -- doesn't discover new ones). |
readManifest($url)
PackageManager.php:243Read manifest and trigger manifest-read hook
| $url | string | a url to mmo.json (phar works) |
| returns | PackageManifest |
setCompression($compression)
PackageManager.php:122setProject($url)
PackageManager.php:149Set the main manifest (mmo.json) to load for the project
__construct($config)
PackageManager.php:98Includes this framework's own package (mmo.core), then discovers sibling .phar packages if running from one itself.
| $config | array |
Inherited members (46)
| Constants | Declared by | Description | |
|---|---|---|---|
ALERT | iLogLevel | Alert: Action must be taken immediately. | |
ALL | iLogLevel | Mask for all | |
ALL_PLUS | iLogLevel | debug everything | |
BACKTRACE | iLogLevel | ||
CRITICAL | iLogLevel | Critical: Critical conditions. | |
DEBUG | iLogLevel | Debug: Detailed debug information. | |
DEEP | iLogLevel | debug everything with arguments | |
EMERGENCY | iLogLevel | Emergency: System is unusable. | |
ERROR | iLogLevel | Error: Runtime errors that do not require immediate action but should typically be logged and monitored. | |
ERROR_PLUS | iLogLevel | Mask for all error | |
FATAL | iLogLevel | Mask for all fatal error | |
INFO | iLogLevel | Info: Interesting events. | |
INFO_PLUS | iLogLevel | Mask for all errors/warning/notices/info | |
MEMORY | iLogLevel | include backtrace object | |
NOTICE | iLogLevel | Notice: Normal but significant events. | |
NOTICE_PLUS | iLogLevel | Mask for all errors/warning/notices/info | |
TRACE | iLogLevel | include backtrace as origins | |
WARNING | iLogLevel | Warning: Exceptional occurrences that are not errors. | |
WARNING_PLUS | iLogLevel | Mask for all errors and warnings |
| Properties | Declared by | Description | |
|---|---|---|---|
verbosity | aModule |
| Methods | Declared by | Description | |
|---|---|---|---|
alert($message, $context) | aModule | Action must be taken immediately. | |
backtraces($message, $context) | aModule | Force-log a message at INFO level together with a full stack trace/memory snapshot (iLogLevel::BACKTRACE), bypassing the verbosity mask entirely (any non-zero verbosity is enough to trigger it). | |
Configure($config) | aModule | Merge $config into this module's configuration in the shared Configuration. | |
critical($message, $context) | aModule | Critical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask. | |
debug($message, $context) | aModule | Detailed debug information. | |
debugName() | aModule | Human-readable identifier used as the default {origin} in this instance's log messages. | |
emergency($message, $context) | aModule | System is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask. | |
error($message, $context) | aModule | Runtime errors that do not require immediate action but should typically be logged and monitored. | |
getVerbosity() | aModule | ||
info($message, $context) | aModule | Interesting events. No-op if INFO is currently filtered out by the verbosity mask. | |
Instantiate($config) | aModule | (Re)create the shared instance immediately, configured with $config merged into the class's existing config. | |
IsShared() | aModule | ||
log($level, $message, $context) | aModule | Logs with an arbitrary level. | |
notice($message, $context) | aModule | Normal but significant events. | |
offsetExists($key) | aModule | \ArrayAccess::offsetExists -- tells whether $key is a declared property at all, regardless of whether it is currently readable/writable through array access. | |
offsetGet($key) | aModule | \ArrayAccess::offsetGet -- reads a property directly, unless it has a #[Serialize(serialize: 'methodName')] attribute, in which case that zero-argument method is called instead (e.g. | |
offsetSet($key, $value) | aModule | \ArrayAccess::offsetSet -- sets a property directly, unless it has a #[Serialize(unserialize: 'methodName')] attribute, in which case that method is called with $value instead (e.g. | |
offsetUnset($key) | aModule | \ArrayAccess::offsetUnset -- equivalent to $module[$key] = null. | |
serialize($path, $serializer) | aModule | \MMO\core\interfaces\iSerializable::serialize -- exports every property (via | |
setVerbosity($verb) | aModule | Set the current verbosity mask, replacing whatever it was before. | |
Shared() | aModule | Get the shared instance, creating (and configuring) it on first call. | |
testVerbosity($level) | aModule | Test whether a given level (or set of levels) is currently enabled by this instance's verbosity mask. | |
traitUnshare($serialize) | aModule | Remove the shared instance, so the next Shared() call creates a fresh one. | |
unserialize($data, $path, $instances) | aModule | \MMO\core\interfaces\iSerializable::unserialize -- merges $data onto DefaultConfig, runs it through the (possibly overridden) constructor, then applies each resulting value to its property (via | |
Unshare($serialize) | aModule | Like tSingleton::Unshare, but also disconnects this module's instance from every event it was listening to (via Event::DisconnectListeners) before dropping it. | |
warning($message, $context) | aModule | Exceptional occurrences that are not errors. |