leowebguy / git-info
Output git info over twig
2.0.0
2024-03-27 02:02 UTC
Requires
- php: ^8.2
- craftcms/cms: ^5.0
Requires (Dev)
- craftcms/ecs: dev-main
- craftcms/phpstan: dev-main
- craftcms/rector: dev-main
- laravel/pint: ^1.14.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Output git info over Twig.
Requirements
This plugin requires:
- Craft CMS:
^5.0.0 - PHP:
^8.2 || ^8.3 || ^8.4 || ^8.5
Installation
Shell
composer require leowebguy/git-info -w && php craft plugin/install git-info
DDEV
ddev composer require leowebguy/git-info -w && ddev exec php craft plugin/install git-info
Usage
{{ craft.git.branch }}→ Current branch (e.g.main,staging){{ craft.git.remoteUrl }}→ Remote URL (e.g.github.com:leowebguy/git-info.git){{ craft.git.lastTag }}→ Latest git tag (e.g.2.1.0){{ craft.git.commitHash }}→ Last commit hash{{ craft.git.commitAuthor }}→ Last commit author name{{ craft.git.commitDate }}→ Last commit date (YYYY/MM/DD HH:MM:SS)
Example
{% if not craft.app.config.custom.isProd %}
<div style="position: fixed; bottom: 1rem; right: 1rem; padding: 6px 10px; text-align: right; border: solid 1px #eee; z-index: 999; background: #fff;">
{{ 'branch: ' ~ craft.git.branch }}<br>
{{ 'remote url: ' ~ craft.git.remoteUrl }}<br>
{{ 'last tag: ' ~ craft.git.lastTag }}<br>
{{ 'commit hash: ' ~ craft.git.commitHash }}<br>
{{ 'commit author: ' ~ craft.git.commitAuthor }}<br>
{{ 'commit date: ' ~ craft.git.commitDate }}
</div>
{% endif %}
Development
# Static analysis (PHPStan level 8) composer phpstan # Code style testing (Pint) composer pint-test # Code style formatting (Pint) composer pint
