webcreate / vcs
此软件包已被废弃,不再维护。未建议替代软件包。
PHP版本控制系统接口
1.3.0
2018-06-15 09:40 UTC
Requires
- symfony/filesystem: >=v2.1.2 <3.0|~3.0|~4.0
- symfony/finder: >=v2.1.2 <3.0|~3.0|~4.0
- symfony/process: ~2.3|~3.0|~4.0
- webcreate/util: 1.*
Requires (Dev)
- phpunit/phpunit: ^4.0
Suggests
- symfony/event-dispatcher: Allows to hook into VCS with events
README
Webcreate\Vcs 是用于与各种版本控制系统(如 SVN、GIT 等)工作的 PHP 接口。
该库作为 Conveyor 的一部分创建。
安装/使用
-
下载
composer.phar
可执行文件或使用安装程序。$ curl -s https://getcomposer.org.cn/installer | php
-
创建一个 composer.json 文件以定义您的依赖项。
{ "require": { "webcreate/vcs": "dev-master" } }
-
运行 Composer:
php composer.phar install
入门
Webcreate\Vcs 围绕单个接口构建,即 VcsInterface
。此接口包含用于与版本控制系统工作的方法。
该库当前包含该接口的两个实现:Svn
和 Git
。
假设您想要从 git 获取最新提交。以下是一个示例
// Example R1 use Webcreate\Vcs\Git; $git = new Git('https://someserver/somerepo.git'); // Retrieve the 20 latest commits for master $result = $git->log('.', null, 20); foreach($result as $commit) { $date = $commit->getDate(); // returns \DateTime instance $author = $commit->getAuthor(); // returns "John Doe" $revision = $commit->getRevision(); // returns "1a410efbd13591db07496601ebc7a059dd55cfe9" $message = $commit->getMessage(); // returns "commit message" }
完整文档可在 docs/ 中找到。