tjvb/gitlab-models-for-laravel
Composer 安装命令:
composer require tjvb/gitlab-models-for-laravel
包简介
Save the GitLab data in your Laravel project
README 文档
README
Purpose
GitLab push data for different objects with its webhook, this package provides the option to store that data in your database. Under the hood it use tjvb/gitlab-webhooks-receiver-for-laravel for receiving the webhook data. After storing the data it will dispatch an event that can be used to update other parts of your data or react on the new input.
Installation
You can install the package via composer:
composer require tjvb/gitlab-models-for-laravelYou can publish and run the migrations for GitLab Models for Laravel and GitLab Webhooks with:
php artisan vendor:publish --provider="TJVB\GitLabWebhooks\GitLabWebhooksServiceProvider" --tag="migrations"
php artisan vendor:publish --provider="TJVB\GitlabModelsForLaravel\Providers\GitlabModelsProvider" --tag="migrations"
php artisan migrate
- Set the
GITLAB_WEBHOOK_SECRETenv variable (most used version is to set it in the .env file) to have the token you use for your webhook. See https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#secret-token for more information. - Create a webhook in GitLab.
You can create a webhook in GitLab for your project, group or system. The default url is
<application.tld>/gitlabwebhookthis can be changed in the configuration from tjvb/gitlab-webhooks-receiver-for-laravel. - Optional configure the package.
- Listen to the events
Manual register the service provider.
If you disable the package discovery you need to add \TJVB\GitlabModelsForLaravel\Providers\GitlabModelsProvider::class, and \TJVB\GitLabWebhooks\GitLabWebhooksServiceProvider::class, to the providers array in config/app.php.
Events
The package dispatched multiple events after saving the received data (a create or update) The event contains the new data.
TJVB\GitlabModelsForLaravel\Events\BuildDataReceivedTJVB\GitlabModelsForLaravel\Events\DeploymentDataReceivedTJVB\GitlabModelsForLaravel\Events\IssueDataReceivedTJVB\GitlabModelsForLaravel\Events\MergeRequestDataReceivedTJVB\GitlabModelsForLaravel\Events\NoteDataReceivedTJVB\GitlabModelsForLaravel\Events\PipelineDataReceivedTJVB\GitlabModelsForLaravel\Events\ProjectDataReceivedTJVB\GitlabModelsForLaravel\Events\TagDataReceived
Configuration
Env variables
There are a couple of env variables that can be used to change the data that should be stored.
| Key | Default | Description |
|---|---|---|
GITLAB_MODELS_QUEUE_CONNECTION | null | The queue connection for the HookStoredListener, if not provided it will use the project default. |
GITLAB_MODELS_QUEUE_QUEUE | null | The queue for the HookStoredListener, if not provided it will use the project default. |
GITLAB_MODELS_STORE_BUILDS | true | That we want to store the data from the builds. |
GITLAB_MODELS_STORE_DEPLOYMENTS | true | That we want to store the data from the deployments. |
GITLAB_MODELS_STORE_ISSUES | true | That we want to store the data from the issues. |
GITLAB_MODELS_STORE_MERGE_REQUESTS | true | That we want to store the data from the merge requests. |
GITLAB_MODELS_STORE_NOTES | true | That we want to store the data from the notes (comments). |
GITLAB_MODELS_STORE_PIPELINES | true | That we want to store the data from the pipelines. |
GITLAB_MODELS_STORE_PROJECTS | true | That we want to store the data from the projects. |
GITLAB_MODELS_STORE_TAGS | true | That we want to store the data from the tags. |
Customization
You can publish the config file with:
php artisan vendor:publish --provider="TJVB\GitlabModelsForLaravel\Providers\GitlabModelsProvider" --tag="config"
Security
The default configuration validates the X-Gitlab-Token in the header of the webhook request. It is possible to add multiple values in the config file or disabling the middleware to stop the verification. If you need more validation for the request (as example and i.p. filter) you can add more middleware to the configuration.
Changelog
We (try to) document all the changes in CHANGELOG so read it for more information.
Contributing
You are welcome to contribute, read about it in CONTRIBUTING
Security
If you discover any security related issues, please email info@tjvb.nl instead of using the issue tracker.
Credits
Thanks to
- GitLab for the great product, without that this package isn't needed.
License
The MIT License (MIT). Please see License File for more information.
tjvb/gitlab-models-for-laravel 适用场景与选型建议
tjvb/gitlab-models-for-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.09k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 08 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「gitlab」 「tjvb」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tjvb/gitlab-models-for-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tjvb/gitlab-models-for-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tjvb/gitlab-models-for-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Catch all mail in Laravel and redirect it to a configured email address
Get the current git hash from your project, show it in your blade or add it to your logs.
Get the current git hash from your project.
PHP GitLab generic API client (not stick to any version)
A collection of monolog handlers using PSR-18 http client
Receive webhooks from GitLab and store the data in the database.
统计信息
- 总下载量: 5.09k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-16