ryanxedi / git-info
Access your local git branch information
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
pkg:composer/ryanxedi/git-info
README
About gitInfo
gitInfo is a simple tool to retrieve the current branch or hash of your Laravel project:
Getting Started
Pull in the package composer require ryanxedi/git-info
Make this available globally:
Add this to the bottom of your aliases array in config/app.php
'gitInfo' => ryanxedi\gitInfo\gitInfo::class,
Usage
To return your current branch
gitInfo::branch()
To return your current branch's hash
gitInfo::hash()
Example
Try this example blade code snippet:
Add the font-awesome CDN to your HTML header section:
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" rel="stylesheet" />
Presumably, you don't want this to appear in your production environment.
You can wrap this in an @if() statement in your footer
@if (env('APP_ENV') != 'production')
<i class="fa-solid fa-code-branch"></i> {{ gitInfo::branch() }}
@endif
Update 'production' to whatever you call your production environment in you .env file
License
gitInfo is open-sourced software licensed under the MIT license.