Composer Packages
Enhance your project's capabilities by integrating Composer packages from GitLab's Package Registry. Begin by updating your project's composer.json file and adding an auth.json for authentication (see Composer Authentication). Streamline your development process with these essential steps.
Automated Setup
Explore the Gesso Registry, accessible
here, to discover
a comprehensive list of available Gesso packages. Once you've identified your
desired package, such as gesso_graphql
, copy the command provided under
Add composer registry
and execute it in your terminal.
Example
For instance, executing the following commands will update your composer
configurations to include the necessary repository support for gesso_graphql
,
which is assigned a group ID of 507.
composer config repositories.git.acromedia.com/507 '{"type": "composer", "url": "https://git.acromedia.com/api/v4/group/507/-/packages/composer/packages.json"}'
composer config gitlab-token.git.acromedia.com <YOUR_PERSONAL_ACCESS_TOKEN>
composer config gitlab-domains git.acromedia.com
Manual Setup
If you prefer to set up your composer.json file manually, you can utilize the
example provided below. Remember to substitute <GroupID>
with the appropriate
group ID of the project package you're seeking.
{
...
"repositories": {
"git.acromedia.com/<GroupID>": {
"type": "composer",
"url": "https://git.acromedia.com/api/v4/group/<GroupID>/-/packages/composer/packages.json"
},
"0": {
"type": "composer",
"url": "https://packages.drupal.org/8"
}
},
"require": {
"acromedia/gesso_graphql": "^0.0.1",
...
},
"config": {
...
"gitlab-domains": ["git.acromedia.com"]
},
...
"minimum-stability": "dev",
}
Finding Your Project's Group ID
To find the Group ID
of your project, navigate to your project group's
settings page in GitLab. The Group ID
can usually be found on the General page
next to the Group name
field. If you encounter difficulty locating it, please
refer to GitLab's documentation or contact your project administrator for
assistance. Eg. https://git.acromedia.com/groups/acromedia/gesso/-/edit
Composer Authentication
Authentication setup is necessary to access Composer packages securely.
Create an auth.json
file within your project. Ensure that auth.json
is included in your .gitignore
file to prevent accidental commits of your personal access tokens.
- It is crucial to never commit the
auth.json
file to your repository. - If you are creating your access token, refer to the Personal Access Token page to determine the appropriate scope to use.
Example of the auth.json
file:
{
"gitlab-token": {
"git.acromedia.com": "<Your Gitlab Personal Access Token>"
}
}