This page explains the steps to install Fusion as a standalone tool, which includes downloading it as a PHP package and setting it up as a system-wide executable.
Environment
Fusion requires at least PHP 8.1.0
to run. Check the installed version on
your system by executing the following command in your terminal:
php -v
Ensure the required curl
and recommended zip
extensions are available:
php -m
Note
If the zip
extension is missing, Fusion will fall back to using the pre-built
Phar
extension to handle archives, which is more memory-intensive.
Package
Download an archive of the latest release from GitLab to a location of your choice. Extract it there and rename the folder to "fusion." In the root directory of the extracted folder, you will find the "fusion" file, which serves as the default entry point for any interaction via the command line interface (CLI). In addition to the filename, CLI interaction also requires at least one trailing task name.
Since Fusion is also a package, we can use it recursively to demonstrate CLI
interaction. In your terminal, set the working directory to the extracted
folder and execute the fusion
file by passing the build
task command:
php fusion build
Depending on the latest version, the output should be similar:
___ _ _ ___ ___ ___ _ _
| __| | | / __|_ _/ _ \| \| |
| _|| |_| \__ \| | (_) | .` |
|_| \___/|___/___\___/|_|\_|
------
boot via command line interface
execute build id
image
image internal metas
[=| valvoid/fusion | 1.0.2
build
build external metas
...
[+| valvoid/fusion | 1.0.2
categorize
categorize metas efficiently
recycle:
[=| valvoid/fusion | 1.0.2
download
cache external packages
copy
cache internal packages
extend
refresh cached extension files
[=| valvoid/fusion | 1.0.2
inflate
inflate current packages
[=| valvoid/fusion | 1.0.2
register
register internal packages
[=| valvoid/fusion | 1.0.2
snap
persist implication and references
production:
stack
stack new state
shift
shift state
Internally, each task is a single action object that can be part of a group to handle complex workloads, such as the package manager update triggered above.
The build
task handles external
metadata, package info files outside the
current project/package root, and requires helper tasks to perform the update.
As the output above shows, the group starts with the image
helper task,
which is responsible for internal
metadata files inside the root directory.
Once both tasks are complete, the categorize
helper task evaluates the
results and, in this case, chooses to recycle
the same
valvoid/fusion | 1.0.2
package.
Since you already have the latest Fusion version, the extend
, inflate
,
and register
tasks regenerate the local package cache.
Global Executable
Usually, your working directory will be inside a project or one of its dependencies, rather than the root of the extracted Fusion folder. Since PHP requires the full path to the script unless you're inside the folder, running Fusion this way can be cumbersome. For example:
php /whatever/full/path/fusion build
To simplify usage, let's make Fusion globally executable, allowing you to run it from any directory you're currently in, just by its name, such as:
fusion build
Follow the steps that apply to your operating system:
Linux
In your terminal, navigate to the root of the extracted Fusion folder and create a symbolic link:
sudo ln -s $PWD/fusion /usr/local/bin/fusion
macOS
First, ensure that the required /usr/local/bin
directory exists by running
the following command:
sudo mkdir -p /usr/local/bin
Next, navigate to the root of the extracted Fusion folder and create a symbolic link:
sudo ln -s $PWD/fusion /usr/local/bin/fusion
Windows
First, ensure that the required C:\bin
directory exists by running
the following PowerShell command:
New-Item -Path "C:\bin" -ItemType Directory -Force
Next, navigate to the root of the extracted Fusion folder and create from there a
batch file inside the C:\bin
directory:
Set-Content -Path "C:\bin\fusion.bat" -Value "@php $PWD\fusion %*"
Finally, add the directory C:\bin
to the Path
variable:
- Open the Start menu, search for "Environment Variables," and select "Edit the system environment variables."
- In the "System Properties" window, click on "Environment Variables."
- Under "System variables," find and select the
Path
variable, then click "Edit." - Click "New" and add
C:\bin
to the list, then click "OK" to apply the changes. - Restart your PowerShell session for the changes to take effect.
Interaction
Once the setup is complete, let's use Fusion as an example package again. In your terminal, set the working directory to any subdirectory within the extracted package manager folder (not the root directory containing the "fusion" file), then run the build command again:
fusion build
The output should be the same as in the Package section above.