gdn-dev/laragit-version
Composer 安装命令:
composer require gdn-dev/laragit-version
包简介
Simple Laravel package to manage versions using VERSION files or Git tags
README 文档
README
A simple Laravel package to manage versions in your project using either VERSION files or Git tags. No complex configuration required.
✨ Features
- 🚀 Zero Configuration - Works out of the box
- 📄 VERSION File Support - Read version from VERSION files
- 🎯 Git Integration - Uses your existing Git tags as fallback
- 🤐 Silent Git Errors - No error logs when Git is not available
- 🔧 Blade Directive - Easy template integration
- 📱 Laravel 9-12 - Supports Laravel 9, 10, 11, and 12
📋 Requirements
- PHP 8.1 or higher
- Laravel 9.0 - 12.x
📦 Installation
Install the package via Composer:
composer require gdn-dev/laragit-version
The package will automatically register itself via Laravel's auto-discovery.
🚀 Quick Start
Basic Usage
use GenialDigitalNusantara\LaragitVersion\Facade as LaragitVersion; // Get version with default formatting echo LaragitVersion::show(); // "Version 1.0.0" // Get compact version echo LaragitVersion::show('compact'); // "v1.0.0" // Get version info as array $info = LaragitVersion::getVersionInfo();
Using VERSION File
// Create VERSION file in project root file_put_contents(base_path('VERSION'), '2.1.0'); // Use normally echo LaragitVersion::show(); // "Version 2.1.0" echo LaragitVersion::show('compact'); // "v2.1.0"
Blade Templates
Use the convenient Blade directive:
{{-- Default format --}} @laragitVersion {{-- Compact format --}} @laragitVersion('compact')
Service Container
// Via service container $version = app('gdn-dev.laragit-version')->show(); // Via dependency injection public function __construct(LaragitVersion $laragitVersion) { $this->version = $laragitVersion->show(); }
🎯 How It Works
The package uses a simple approach:
'version' => file_exists(base_path('VERSION')) ? trim(file_get_contents(base_path('VERSION'))) : (isGitAvailable() ? trim(exec('git describe --tags --abbrev=0 2>/dev/null')) : '0.0.0')
- First checks for a VERSION file in your project root
- If found, uses the content as the version
- If not found, checks if Git is available
- If Git is available, tries to get the version from Git tags
- If Git is not available or no tags found, returns "0.0.0" as default
- Never produces error logs when Git is not available
📄 License
The MIT License (MIT). Please see License File for more information.
👥 Credits
⭐ Show Your Support
Give a ⭐️ if this project helped you!
Made with ❤️ by Genial Digital Nusantara
gdn-dev/laragit-version 适用场景与选型建议
gdn-dev/laragit-version 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 84 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「git」 「version」 「Simple」 「versioning」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 gdn-dev/laragit-version 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gdn-dev/laragit-version 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 gdn-dev/laragit-version 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easily manage git hooks in your composer config
Versioning behaviour for eloquent models
Converts SemVer version (like Composer packages) into integer version with operators. Helps managing versions: store, compare, sort and retrive by conditions.
A simple library for make Lexer and Parsers to build a language
A simple library that allows transform any kind of data to native php data or whatever
A simple library that uses the hydration pattern to fill objects given different sources of data.
统计信息
- 总下载量: 84
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-24