standard-library / sdk-phar
Package info
gitlab.com/php-standard-library/release-packages/sdk-phar
Type:standard-library-sdk
pkg:composer/standard-library/sdk-phar
Requires
- php: ^8.5.0
- standard-library/sdk: ^1.0.30
- symfony/filesystem: ^v8.0.4
- symfony/process: ^v8.0.4
This package is not auto-updated.
Last update: 2026-08-12 09:01:43 UTC
README
Compiles a console application into a single, directly executable .phar file, using
Box under the hood. Process/filesystem handling uses
symfony/process and symfony/filesystem; the project-copy/composer-install pieces are shared
with standard-library/sdk-application's directory build via standard-library/sdk's
StandardLibrary\Sdk\Build\ namespace.
{
"require-dev": {
"standard-library/sdk-phar": "^1.0"
}
}
Commands
| Command | Purpose |
|---|---|
bin/sdk app:build-phar | Compile a console application into a single .phar file. |
This is a bin/sdk command (see standard-library/sdk's README) — run it in Docker with
--docker (e.g. bin/sdk app:build-phar --docker).
It reads config-dev.yaml under the section keyed by its own fully qualified class name (see
standard-library/sdk's Console\Command base class).
config-dev.yaml
'StandardLibrary\Sdk\Phar\Console\Command\PharBuildCommand':
entrypoint: bin/console
output: artifacts/app.phar
dirs:
- src
files:
- bin/console
- composer.json
- composer.lock
exclude:
- vendor/bin
compression: GZ
entrypointis required: the CLI script (relative to the project root) that becomes the PHAR's main entry point (e.g. a Symfony Consolebin/console), and must be listed underfiles(or fall under a listeddirsentry) so it actually ends up in the build.outputis required: the.pharfile path (relative to the project root) the finished build is moved to.dirs/filesare optional. If both are empty, the whole project is used (viagit cloneof the project's own.git, i.e. exactly the committed tree). If either is set, only the listed directories/files are extracted viagit archive, so uncommitted or gitignored files can never end up in the build even when only part of the project is selected.excludeis an optional list of paths (relative to the build directory) removed aftercomposer install, before compiling — e.g. dev tooling left behind undervendor/bin.compressionis optional: one ofNONE,GZ(default),BZ2.
bin/sdk app:build-phar
- Copies the project into a temporary build directory (see
dirs/filesabove). - Runs
composer install --no-dev --no-interactionin it. - Removes each configured
excludepath. - Downloads (or reuses the cached)
box.phar, and runsbox compileagainst the build directory. - Atomically moves the resulting
.phartooutput(removing any previous build there first).
Why Box isn't a Composer dependency
Box is deliberately not required in composer.json: as a real library dependency its own
requirements conflict with what this monorepo's tooling already pins (Rector needs
nikic/php-parser ^5, PHPUnit 13 needs sebastian/diff ^9, both older than what Box 4 allows).
Box ships as a self-contained PHAR precisely so it can be used standalone instead — the same way
this SDK already assumes composer itself is an ambient binary rather than a Composer dependency.
app:build-phar downloads a pinned, checksum-verified box.phar release into the system temp
directory on first use and reuses it from there afterwards.