定制 premekkoch/github-service 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

premekkoch/github-service

Composer 安装命令:

composer require premekkoch/github-service

包简介

Nette Framework service to get file last modification date from GitHub

README 文档

README

Use this service, if you want to find the last modification date of your repository file on github. Service uses a cache for performace reasons.

Instalation

composer require premekkoch/github-service

Configuration

1. Add section "Github" to parameters section in config.neon:

  parameters:
    GitHub:
      user: GITHUB_USER
      repo: REPOSITORY_NAME
      subdir: REPOSITORY_SUBDIRECTORY
      client_id: CLIENT_ID
      client_secret: CLIENT_SECRET

Item subdir can be empty - use it, if you're working only with one of repo directory only.

2. Register a service in config.neon:

services:
	  githubService: PremekKoch\GitHub\GitHubService(%GitHub.user%, %GitHub.repo%, %GitHub.subdir%, %GitHub.client_id%, %GitHub.client_secret%)

How to use

1. Simple use:

Inject an service into presenter

  /** @var PremekKoch\GitHub\GitHubService @inject */
  public $githubService;

and then call service method

	:
  $file = 'test.md';
  $this->githubService->getFileLastCommit($file, TRUE);
	:

By setting second parameter "useCache" you can decide, if you want to get cashed or "live" data. If this parameter is set to FALSE, GitHub API is called and cache is refreshed automaticaly for this file.

2. Cache refresh:

Simply call

	$this->githubService->refreshGithubCache();

to refresh cache for all files. Or you can do something like this for refresh .md files cache only:

  $tree = $this->gitHubService->getFilesTree();
  foreach ($tree as $file) {
    if (strpos($file->path, '.md')) {
      $this->gitHubService->getFileLastCommit($file->path, FALSE);
  }

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固