markwalet/laravel-git-state 问题修复 & 功能扩展

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

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

markwalet/laravel-git-state

最新稳定版本:v1.9.2

Composer 安装命令:

composer require markwalet/laravel-git-state

包简介

A Laravel package that gives you information about the current git state.

README 文档

README

MIT Licensed Latest Stable Version Build status Coverage Total Downloads

A Laravel package that gives you information about the current git state.

Installation

You can install this package with composer:

composer require markwalet/laravel-git-state

Laravel auto-loads service providers for you, so you don't have to register it. If you want to register the service provider manually, add the following line to your config/app.php file:

MarkWalet\GitState\GitStateServiceProvider::class

Usage

When you want to get information about the current git state, you can inject the MarkWalet\GitState\Drivers\GitDriver class in your methods:

<?php

use MarkWalet\GitState\Drivers\GitDriver;

class Controller {
    
    public function index(GitDriver $driver) {
        $branch = $driver->currentBranch();
        $commit = $driver->latestCommitHash();
        
        return view('index', compact('branch', 'commit'));
    }
}

When injecting a GitDriver like this, you will get an instance of the default driver you configured. If you want to have more control over the driver you are using, you can use the MarkWalet\GitState\GitManager:

<?php

use MarkWalet\GitState\GitStateManager;

class Controller {
    
    public function index(GitStateManager $driver) {
        $branch = $driver->driver('other-driver')->currentBranch();
        
        return view('index', compact('branch'));
    }
}

Configuration

The default configuration is defined in git-state.php. If you want to edit this file you can copy it to your config folder by using the following command:

php artisan vendor:publish --provider="MarkWalet\GitState\GitServiceProvider"

In this file you can configure different drivers for fetching the current Git state, as well as setting a default configuration.

The supported drivers are: exec and file. There is also a fake implementation for testing purposes.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固