This page explains how to customize the default hub config and persist these changes in a standalone installation.
On This Page
Extension Group
Inside the Fusion package, relative to the root, create the following directory:
/extensions/config/valvoid/fusion
As mentioned above, in this example, we extend the standalone installation, so Fusion extends itself using its own identifier as the extension group.
Tokens
By default, the hub interacts with storage systems without authorization, allowing it to pull public packages. To enable the pulling of private packages and increase the API rate limit, you need to add a bearer token.
Generate a token with the appropriate permissions on your platform and configure
related API in a hub.php
file within the extension group directory. For example,
if you are setting up the
API for the default package registry,
your file content might look like this:
<?php
return [
"hub" => [
"apis" => [
// default registry API
// keep or replace with yours
// "gitlab.com"
// "github.com"
// "bitbucket.org"
"valvoid.com" => [
"tokens" =>
// token placeholder
// replace with valid one
"AAT-ZjAxOTE0Y2..."
]
]
]
];
Multiple Tokens
The value of the tokens
key can be an array containing multiple tokens. These
tokens can be optionally separated by nth segments of the
source path.
For example, the file content could be as follows:
<?php
return [
"hub" => [
"apis" => [
// default registry API
// keep or replace with yours
// "gitlab.com"
// "github.com"
// "bitbucket.org"
"valvoid.com" => [
"tokens" =>
// token placeholder
// replace with valid one
"AAT-ZjAxOTE0Y2..."
],
"gitlab.com" => [
"tokens" => [
// all request
"glpat-cR8Q-g...",
// path segment
// group identifier
"/valvoid" => [
// path segment
// package identifier
// only Fusion package manager request
"/fusion/glpat-oRaiG...",
"glpat-gqCC..."
]
]
]
]
]
];
The hub processes these tokens in reverse order, using the deepest tokens first and exchanging them if they are invalid.
For example, the source gitlab.com/valvoid/fusion/'php/'code/1.0.0
would match
the following tokens in this pseudo config:
glpat-oRaiG...
glpat-cR8Q-g...
Custom APIs
If you develop your packages on a self-managed platform, such as GitLab, you can extend the config with custom API IDs as shown in the following example:
<?php
use Valvoid\Fusion\Hub\APIs\Remote\GitLab\GitLab;
use Valvoid\Fusion\Hub\APIs\Remote\GitHub\GitHub;
use Valvoid\Fusion\Hub\APIs\Remote\Bitbucket\Bitbucket;
return [
"hub" => [
"apis" => [
// default registry API
// keep or replace with yours
// "gitlab.com"
// "github.com"
// "bitbucket.org"
"valvoid.com" => [
"tokens" =>
// token placeholder
// replace with valid one
"AAT-ZjAxOTE0Y2..."
],
"custom-gitlab.com" => [
"api" => GitLab::class
"tokens" => [
// all request
"glpat-cR8Q-g...",
]
],
"custom-bitbucket.com" => Bitbucket::class,
"custom-github.com" => [
"api" => GitHub::class
"tokens" => "glpat-cR8Q-g..."
]
]
]
];