baraja-core / gitlab-api
Simple and robust GitLab API wrapper with Tracy debug mode.
Requires
- php: ^8.0
- ext-curl: *
- nette/caching: ^3.0
Requires (Dev)
- jetbrains/phpstorm-attributes: ^1.0
- nette/security: ^3.0
- phpstan/phpstan: ^0.12.74
- phpstan/phpstan-nette: ^0.12.14
- roave/security-advisories: dev-master
- spaze/phpstan-disallowed-calls: ^1.1
- tracy/tracy: ^2.8
- dev-master
- v2.0.0
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.1
- v1.0.0
- dev-dependabot/composer/spaze/phpstan-disallowed-calls-tw-3.4
- dev-dependabot/composer/phpstan/phpstan-nette-tw-1.3.2
- dev-dependabot/composer/phpstan/phpstan-tw-1.11.7
- dev-restyled/renovate/configure
- dev-renovate/configure
- dev-dependabot/add-v2-config-file
This package is auto-updated.
Last update: 2024-12-10 05:33:46 UTC
README
This package serves as a transport layer between a specific application and GitLab.
With this package, you can easily submit queries to GitLab, detect error messages in the Tracy bar, and monitor request load.
Requests of type GET
are automatically cached for 12 hours
unless told otherwise.
Requests like POST
, PUT
, DELETE
and other change actions are not cached at all and we always retransmit all data.
Installation
Use the Composer command:
composer require baraja-core/gitlab-api
Next, you need to set the service configuration for Nette in the NEON file.
Default minimum configuration:
services: gitLabAPI: factory: baraja\GitLabApi\GitLabApi(%gitLab.token%) parameters: gitLab: token: 123-abcDEFghiJKL-789 tracy: bar: - Baraja\GitLabApi\GitLabApiPanel
You must always change the API token for your user account!
Configuration
In the parameters
section, you need to enter the default API token to connect to GitLab:
Example:
parameters: gitLab: token: 123-abcDEFghiJKL-789
Optionally, you can set to use Nette Cache:
services: gitLabAPI: factory: baraja\GitLabApi\GitLabApi(%gitLab.token%) setup: - setCache(@cache.storage)
Linking to a custom GitLab installation
In some cases, you need to link the API to the internal corporate network where GitLab is hosted. This is done by using the setBaseUrl()
method with a domain path.
The passed parameter can be, for example, the string 'https://gitlab.com/api/v4/'
.