biurad / git-scm

PHP中用于处理Git仓库和Git服务的库。

dev-master / 2.x-dev 2024-02-21 08:07 UTC

This package is auto-updated.

Last update: 2024-09-21 09:27:52 UTC


README

宝库 Git-SCM

Latest Version Software License Code Maintainability Coverage Status Quality Score

一个轻量级的PHP库,用于处理Git版本控制管理(SCM)。它是一个简单、易于使用且功能强大的工具,用于管理您的Git仓库。

📦 安装

需要PHP 8.0或更高版本以及GIT 2.30或更高版本。推荐的安装方式是使用Composer。只需运行

$ composer require biurad/git-scm

📍 快速入门

此库只是GIT壳命令的简单包装,并解析输出,以便您可以在PHP代码中使用它。性能不如Git,但仍然足够快,可以用于生产。

以下是如何使用此库的示例

use Biurad\Git;

$repo = new Git\Repository('/path/to/repository');
$repo->commit(new Git\CommitNew(
    message: new Git\Commit\Message('My commit message'),
    author: $repo->getAuthor()->setDate('Tue, 06 Sep 2022 07:21:10')
)); // Stage all changes and commit them

$repo->getLog()->getCommits(); // Get all commits
$repo->getLastCommit(); // Get the newest commit

$branches = $repo->getBranches(); // Get all branches
$tags = $repo->getTags(); // Gt all tags

📓 文档

关于如何使用此库的深入文档可以在docs.biurad.com找到。还建议浏览tests目录中的单元测试。

🙌 赞助商

如果此库已经用于您的项目,或者您有兴趣支持我们,请考虑捐赠以支持未来的开发。

👥 致谢

📄 许可证

Git SCM是完全免费的,并按BSD 3许可证发布。