mborne/remote-git
Composer 安装命令:
composer require mborne/remote-git
包简介
A lightweight PHP client providing a consistent way to find hosted and self-hosted git repositories (github, gitlab,...)
README 文档
README
Description
A lightweight PHP client providing a consistent access to hosted and self-hosted git repositories (github, gitlab, gogs and gitea).
Use cases
- The original development has been realized in mborne/satis-gitlab repository to generate a config file referencing git repositories.
- This module is also used by mborne/git-manager to backup and analyse git repositories (for example that following files are present : README.md, LICENSE,...)
Features
- List repositories from multiple GIT hosting services filtering by
- usernames
- organizations/groups
- Get raw files from repositories
- Apply custom filter
- Project contains a given file (
RequiredFileFilter) - Project is a composer project (
ComposerProjectFilter) - Project name doesn't match a given regexp (
IgnoreRegexpFilter)
- Project contains a given file (
Requirements
- PHP >= 8.3
- Supported GIT hosting services :
| Type | Description |
|---|---|
| gitlab-v4 | gitlab.com and self hosted gitlab instances |
| github | github.com |
| gogs-v1 | Gogs or Gitea |
Usage
Create a client
// configure client $clientOptions = new ClientOptions(); $clientOptions ->setUrl('https://github.com') ->setToken($token) ; // create client $client = ClientFactory::createClient( $clientOptions, new NullLogger() );
Filter by usernames or orgs/groups
$options = new FindOptions(); // Use '_me_' on github to include private repositories $options->setUsers(array('mborne')); $options->setOrganizations(array('symfony','FriendsOfSymfony')); $projects = $client->find($options);
Filter according to composer.json
$options = new FindOptions(); $options->setUsers(array('mborne')); $filter = new ComposerProjectFilter($client); $filter->setType('library'); $options->setFilter($filter); $projects = $client->find($options);
Compose filters
$options = new FindOptions(); $options->setUsers(array('mborne')); $filterCollection = new FilterCollection(); // filter according to composer.json $composerFilter = new ComposerProjectFilter($client); $composerFilter->setType('library'); $filterCollection->addFilter($composerFilter); // filter according to README.md $filterCollection->addFilter(new RequiredFileFilter( $client, 'README.md' )); $options->setFilter($filterCollection); $projects = $client->find($options);
Dependencies
License
Testing
- Configure access token for github.com and gitlab.com APIs (optional) :
# see https://github.com/settings/tokens export GITHUB_TOKEN=AnyGithubToken # see https://gitlab.com/-/profile/personal_access_tokens export GITLAB_TOKEN=AnyGitlabToken # see https://gitea.com/user/settings/applications export GITEA_TOKEN=AnyGiteaToken
- Install dependencies and run tests :
make test # Alternative : # composer install # vendor/bin/phpunit -c phpunit.xml.dist
Note that an HTML coverage report is generated to output/coverage/index.html
mborne/remote-git 适用场景与选型建议
mborne/remote-git 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.15k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 11 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mborne/remote-git 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mborne/remote-git 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8.15k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 10
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-11-25