Index

MMO\core\packages

MMO\core\packages · 3 symbols · generated 5 Oct 2026

function

build

packages.php:76

Build a .phar package from a manifest and a list of source files.

function build( string $filename, string $root, array $sources, string $manifest = 'mmo.json', ?string $bootstrap = 'src/bootstrap.php', int $compression = Phar::NONE ): void
Namespace
MMO\core\packages
$filenamestringthe absolute phar filename to create
$rootstringthe root folder for the relative filenames in $sources/$manifest/$bootstrap
$sourcesarraylist of source filenames to include, as [localNameInPackage =>] filename. if a filename starts with =, it is used as-is as direct php source code instead of a path to read
$manifest = 'mmo.json'stringthe mmo.json filename (relative to $root), packaged as mmo.json
$bootstrap = 'src/bootstrap.php'null | stringthe filename for the bootstrap (relative to $root). null to package an empty stub instead
$compression = Phar::NONEinta \Phar::* compression constant (e.g. \Phar::GZ, \Phar::BZ2)
returnsvoid
build( '/build/mymodule.phar', '/project', ['src' => 'src', 'README.md' => 'README.md'], 'mmo.json', 'src/bootstrap.php' );
Call graph
function

sortUrls

packages.php:43

Sort a (possibly nested) array of source urls by urlPriority, in place.

function sortUrls(array &$urls): array
Namespace
MMO\core\packages
A list (numerically indexed) is deduplicated and sorted directly; an associative array is left as-is but recursed into, so a `{group: [urls...]}` structure has every inner list sorted independently. $grouped = ['group1' => ['https://x', '/local'], 'group2' => ['git@y']]; sortUrls($grouped); // each inner list is sorted independently, the top-level keys are untouched
$urlsarray
returnsarraythe same array, sorted (also returned by reference for convenience/chaining)
$urls = ['https://example.com/x.php', '/local/file.php', 'git@github.com:me/repo.git']; sortUrls($urls); // ['/local/file.php', 'git@github.com:me/repo.git', 'https://example.com/x.php']
Call graph
function

urlPriority

packages.php:23

Rank a source url so lower-priority (cheaper/faster to read) sources are processed first by sortUrls.

function urlPriority(string $url): int
Namespace
MMO\core\packages
Local files are cheapest (0), then git remotes (1), then already-built phar archives (2, since reading a phar generally means re-extracting an existing build), everything else (e.g. a plain http(s) url) sorts last (10).
$urlstring
returnsintthe priority (lower sorts first)
urlPriority('phar://build/lib.phar'); // 2 urlPriority('git@github.com:me/repo.git'); // 1 urlPriority('/local/existing/file.php'); // 0 (only if the file actually exists on disk) urlPriority('https://example.com/x.php'); // 10
Call graph

Used by (1)