68publishers/tracy-git-version 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

68publishers/tracy-git-version

Composer 安装命令:

composer require 68publishers/tracy-git-version

包简介

Git version panel for Tracy.

README 文档

README

Tracy Git version

Simple and extensible panel for Tracy that shows information from Git.

Tracy Git version panel

Checks Coverage Status Total Downloads Latest Version PHP Version

Table of contents

Installation

The best way to install 68publishers/tracy-git-version is using Composer:

$ composer require 68publishers/tracy-git-version

Basic integration

Standalone Tracy integration

The simplest way how to register the panel into Tracy is by creating a default instance and providing it directly into a Bar.

use Tracy\Debugger;
use SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\GitVersionPanel;

Debugger::getBar()->addPanel(GitVersionPanel::createDefault());

Integration into Nette Framework

Basic integration into Nette is really simple. Just register an extension.

extensions:
    68publishers.tracy_git_version: SixtyEightPublishers\TracyGitVersion\Bridge\Nette\DI\TracyGitVersionExtension

And everything works 😉

Solution for application builds without Git

Often when we deploy an application to a production environment, neither Git nor the .git directory is available due to trying to have a build as small as possible. However, at this moment we have no source of information about the current version. The solution is to export a file that contains all important information at the time when the Git is still accessible.

Setup for standalone Tracy

You must create repositories and the panel manually but there is not much work to do.

use Tracy\Debugger;
use SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\GitVersionPanel;
use SixtyEightPublishers\TracyGitVersion\Repository\LocalGitRepository;
use SixtyEightPublishers\TracyGitVersion\Repository\ExportedGitRepository;
use SixtyEightPublishers\TracyGitVersion\Repository\ResolvableGitRepository;
use SixtyEightPublishers\TracyGitVersion\Repository\RuntimeCachedGitRepository;
use SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\Block\CurrentStateBlock;

# create a repository that reads from the .git directory:
$localGitRepository = LocalGitRepository::createDefault();

# create a repository that reads from a JSON export:
$exportedGitRepository = ExportedGitRepository::createDefault('/var/git-version/repository.json');

# combine there two repositories, if the .git directory is not accessible then try to read from the export file:
$resolvableGitRepository = new ResolvableGitRepository([$localGitRepository, $exportedGitRepository]);

# add runtime cache, commands results are stored so there are no duplicated calls to the real repository:
$cachedGitRepository = new RuntimeCachedGitRepository($resolvableGitRepository);

# add the panel into Tracy
Debugger::getBar()->addPanel(new GitVersionPanel($cachedGitRepository, [new CurrentStateBlock()]));

Setup for Nette Framework

The setup for Nette is more simple. Just add another extension into your neon configuration.

extensions:
    68publishers.tracy_git_version: SixtyEightPublishers\TracyGitVersion\Bridge\Nette\DI\TracyGitVersionExtension
    68publishers.tracy_git_version.export: SixtyEightPublishers\TracyGitVersion\Bridge\Nette\DI\TracyGitVersionExportExtension

The default name for the exported file is %tempDir%/git-version/repository.json but you can change it.

68publishers.tracy_git_version.export:
    export_filename: %tempDir%/my/custom/path.json

Creating the export file

The export file should be created by executing a script that is located in the composer's bin directory. The script is independent of the application so you must provide the filename of the exported file as an option.

$ vendor/bin/tracy-git-version export-repository --output-file <your_temp>/git-version/repository.json -vv

Advanced guide

If you want to read more about repositories, how to extend them or how to add custom data into the panel, please see the Advanced guide.

Contributing

Before opening a pull request, please check your changes using the following commands

$ make init # to pull and start all docker images

$ make cs.check
$ make stan
$ make tests.all

License

The package is distributed under the MIT License. See LICENSE for more information.

68publishers/tracy-git-version 适用场景与选型建议

68publishers/tracy-git-version 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.94k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 01 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「git」 「nette」 「tracy」 「git version」 「68publishers」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 68publishers/tracy-git-version 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 68publishers/tracy-git-version 我们能提供哪些服务?
定制开发 / 二次开发

基于 68publishers/tracy-git-version 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 11.94k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 33
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-10