search hotlink icon profile hotlink icon

This page explains the basic steps for creating a package that extends Fusion by building upon the lifecycle example. For the complete result of this example, see the GitLab repository. Note that this repository contains content for other examples as well, as the documentation uses a single package for all examples.

On This Page

Metadata

Since the production file fusion.json already contains Fusion as a nested example dependency, the content remains the same:

                {
    "name": "Package",
    "description": "Basic example package.",
    "id": "valvoid/package",
    "version": "0.1.0",
    "structure": {
        "gitlab.com/valvoid/'fusion/'php": "package/==1.0.0-dev:main",
        "/cache": "cache",
        "/extensions/config": "extension",
        "/public": "state",
        "/dependencies": [
            "valvoid.com/valvoid/fusion/1.0.0"
        ]
    },
    "environment": {
        "php": {
            "version": "8.1.0"
        }
    },
    "lifecycle": {
        "migrate": "/lifecycle/migrate.php"
    }
}
            

Note that for all commands in this example chapter, you will be referencing the fusion file located in the root directory of the nested package to apply the examples.

Extension Group

Inside the nested Fusion package, relative to its root directory, create the extension group within the flagged extension directories:

  • Custom config files: /extensions/config/valvoid/package
  • Custom source code files: /extensions/src/valvoid/package

In your terminal, navigate to the root directory of the nested Fusion package if not already there, and execute the following build command:

                php fusion build
            

Once done, the extensions.php file inside the nested Fusion package's /cache directory will contain content created by the helper task extend:

                // Auto-generated by Fusion package manager. 
// Do not modify.
return [
    "/extensions/config" => [
        1 => "valvoid/package",
    ],
    "/extensions/src" => [
        1 => "valvoid/package",
    ],
];
            

Tools

List of classes that Fusion uses internally, which may be useful for your use case:

  • Valvoid\Fusion\Config\Config
  • Valvoid\Fusion\Dir\Dir
  • Valvoid\Fusion\Log\Log
  • Valvoid\Fusion\Tasks\Group
  • Valvoid\Fusion\Hub\Hub
  • Valvoid\Fusion\Metadata\Metadata
  • Valvoid\Fusion\Bus\Bus