Download the PHP package codewithkyrian/platform-package-installer without Composer
On this page you can find all versions of the php package codewithkyrian/platform-package-installer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codewithkyrian/platform-package-installer
More information about codewithkyrian/platform-package-installer
Files in codewithkyrian/platform-package-installer
Package platform-package-installer
Short Description A Composer plugin for platform-aware distribution URL resolution
License MIT
Informations about the package platform-package-installer
Composer Platform Package Installer
The Composer Platform Package Installer is a powerful plugin for platform-aware distribution URL resolution.
The core behavior is simple:
- Your package declares platform-specific artifact URLs or URL templates in
composer.json - At install time, the plugin picks the best URL for the current OS/architecture
- It resolves placeholders (built-in
{version}plus optional custom variables) - It tells Composer to download and install the package from that resolved URL
Requirements
- PHP 8.1+
- Composer 2+
Installation
Install the plugin using Composer:
Then change your package type to platform-package in composer.json:
Core Configuration
All core behavior is configured in composer.json under extra.artifacts.
Legacy extra.platform-urls is still supported for backward compatibility, but is deprecated.
Format A: Simple (no custom variables)
Use this when:
- you are using direct artifact URLs with no placeholders, or
{version}is the only placeholder you need.
Format B: Extended (custom variables + defaults)
Use this when templates include additional placeholders beyond {version}.
Application-Level Variable Overrides
Consumers of your platform package can override variables from their root project:
Variable precedence:
- Root app override (
extra.platform-packages.<package-name>) - Package default (
extra.artifacts.vars) - Built-in
{version}(always provided by plugin)
Placeholder Behavior
{version}is built in and always available- Any
{name}placeholder can be used - Unresolved placeholders cause artifact URL resolution to fail for that package
- If override variables resolve to a URL that does not exist, the plugin retries with package default variables
- On failure, Composer falls back to the package's original
distconfiguration
Platform Matching
The plugin matches the current machine against keys in artifacts:
- OS-only keys:
linux,darwin,windows,raspberrypi - OS + architecture keys:
darwin-arm64,linux-x86_64,windows-32,windows-64, etc. allas final fallback
More specific matches are preferred over generic ones.
Optional Helper: Generate URLs Command
platform:generate-urls is a helper to generate artifact URL entries from a template.
You can also provide platforms as a comma-separated list:
Or with a custom URL template:
Command options:
--platformsplatform identifiers (repeat the flag or use comma-separated values)--dist-typegithub,gitlab,huggingface, or custom template--repo-pathrepository path for built-in templates--extensionforce archive extension
The command writes generated URLs into extra.artifacts.
Testing
Run tests with:
The test suite includes:
- unit tests for matching, templating, and generation logic
- integration tests that run real
composer installflows
License
MIT. See LICENSE.
All versions of platform-package-installer with dependencies
composer-plugin-api Version ^1.1 || ^2.0
composer-runtime-api Version *