Fusion - PHP Package Manager
Package Info
Fusion is a PHP package manager that automates tasks in PHP projects, like managing dependencies, migrating package states, and loading code.
Repository
gitlab.comActivity
- Created on Oct 07, 2024
- Updated on May 28, 2025
Statistics
- 124 requests
- 7 versions
Build Methods
Nested Dependency
To build this package as a
nested dependency of your package, add its default registry source
valvoid.com/valvoid/fusion/1.0.6
to one of your metadata files. For example,
you can include it in the production fusion.json file, such as:
{
"name": "Package",
"description": "An example source package.",
"id": "source/package",
"version": "0.1.0",
"structure": {
"/cache": "cache",
"/dependencies": [
"valvoid.com/valvoid/fusion/1.0.6"
]
},
"environment": {
"php": {
"version": "8.1.0"
}
}
}
Standalone
To build this package as an independent root package, extend the
build command
with the default registry source valvoid.com/valvoid/fusion/1.0.6
as follows:
fusion build build.source=valvoid.com/valvoid/fusion/1.0.6
Optional Repository Source
In addition, to build an
offset reference version, replace the default registry source
in installation methods mentioned above with the
VCS source prefix gitlab.com/valvoid/fusion/'php/'code/
,
and refer to the linked source code repository
for possible branches, commits, and tags to use as the suffix.
Metadata
The synchronized package's metadata file, fusion.json, contains the following content:
{
"name": "Fusion",
"description": "A package manager for PHP-based projects.",
"id": "valvoid/fusion",
"version": "1.0.6",
"structure": {
"valvoid.com/valvoid": "fusion/1.0.0",
"/cache": "cache",
"/extensions": {
"/config": "extension",
"/src": "extension"
}
},
"environment": {
"php": {
"version": "8.1.0",
"modules": [
"curl"
]
}
}
}
Readme
Fusion is a PHP package manager that enhances productivity in PHP-based projects. It simplifies development and maintenance by automating repetitive tasks such as managing dependencies, migrating package states, extending packages, and handling loadable code.
Documentation
The separated documentation repository also has the user-friendly output and contains information about the following key features:
Everything Is a Modular Package
To keep things simple and easy to use, Fusion handles everything, including your project, its dependencies, and even the package manager itself, as a modular package that can be standalone, a nested dependency of another, or both at the same time. This is possible since each package has its own custom directory structure, which you can define in the metadata file as you like.
Scoped Metadata and Snapshot Files
A package can be defined using three individual metadata files, each serving a different use case:
- Optional local development metadata specific to your personal machine.
- Optional shared development metadata used across all machines in the project.
- Production metadata used for releases.
These files intersect in a top-down order, where local metadata overrides shared metadata, and shared metadata overrides production metadata. Fusion also generates a snapshot file for each metadata file, capturing replicable versions of its dependencies.
Lifecycle Callbacks
Each time Fusion builds a new version, it looks for adaptive packages that need to be notified about the change. To make your package this type, add lifecycle callbacks in your metadata at the key stages:
- After the package is recycled, downloaded, installed, or updated.
- Before the package is migrated or deleted.
Auto-Generated Code Registries
When package identifier
segments, defined in your metadata and separated by /
, match or prefix code namespace
segments, separated by \
, Fusion automatically registers your code in two files
for lazy and ASAP (as soon as possible) loading.
- The lazy file contains OOP (Object-Oriented Programming) code for autoloading on demand.
- The ASAP file contains preloadable procedural code.
These files are stored in a custom cache directory relative to the package root and can be used individually within your package or combined into a common autoloader for the root package.
Flexible Package References
Fusion offers full support for semantic versioning, as well as commit, branch, and tag offsets, which can be extended by intuitive, well-known logic for complex references, similar to the syntax used in code:
- Logical
&&
and||
operators. - Comparison signs
!=
,==
,>=
,<=
,>
and<
. - Grouping brackets
()
.
The resolution process uses a conflict-driven clause learning (CDCL) algorithm to ensure efficient decision-making.
Directory Type Indicators
Fusion builds new versions efficiently by recycling existing packages. To instruct the package manager that your package includes a mutable directory built by a callback and should be handled individually as new content, set the state indicator in your metadata.
To allow other packages to extend yours at a special directory using the default built-in, out-of-the-box behavior, set the extension indicator in your metadata. Fusion will also generate an extensions file for your package, containing the parent package IDs and the order in which they extend it, in case your package needs to know this.
Interface-Based Customization
As mentioned above, Fusion is itself a package, and its architecture supports out-of-the-box customization through built-in directory indicators. You can build your own package manager on top by extending it with custom implementations, such as:
- Adding a custom package registry.
- Replacing the download, build, or replication logic.
- Setting a custom log serializer.
Registry
For default packages, see the default registry page.
Contribution
Each merge request serves as confirmation to transfer ownership to the project and must meet the following criteria:
- Own intellectual property.
- Neutral content. Free from political bias, for example.
- Pure PHP without exotic extensions.
See the contributing file if these criteria apply to you.
License
Fusion. A package manager for PHP-based projects.
Copyright Valvoid
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see licenses.