Introducing Fusion – A PHP Package Manager

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. 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

May 12, 2025 - 14:15
 0
Introducing Fusion – A PHP Package Manager

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.

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.

Project Repository

For the source code, issues, or contribution, see the GitLab repository.