hcelebi/gitlab-php-client

此包的最新版本(dev-master)没有可用的许可证信息。

GitLab API 的 PHP 客户端

dev-master 2022-06-28 13:08 UTC

This package is not auto-updated.

Last update: 2024-10-02 22:41:02 UTC


README

安装

安装此客户端的首选方法

php composer.phar require hcelebi/gitlab-php-client

composer require hcelebi/gitlab-php-client

配置

项目中已存在依赖注入,将这些工厂添加到配置中。

GitLabClientFactory.php
BranchServiceFactory.php

项目中不存在依赖注入,将以下代码块添加到应用程序入口点

$container = new Container();
GitLabClientFactory::createService($container);
BranchServiceFactory::createService($container);

用法

从特定的 GitLab 项目获取主分支

/** @var BranchService $branchService */
$branchService = $container->get(BranchService::class);

$projectId = 37129493;
$branch = $branchService->getBranch(37129493, "master");