shadiakiki1986/git-data-repo
Composer 安装命令:
composer require shadiakiki1986/git-data-repo
包简介
Manage saving/loading data from php to a git data repository
README 文档
README
PHP library to manage the storage of key-value pairs in a git repository.
DEPRECATED
I notice often that the chown in composer.json post-install is a problem when I use the code from web with www-data user or from shell in docker with root user. This brings up the need for a separate server that is running with its own "stable" filesystem and file permissions. These would at least be independent of developments in the git-data-repo library, as well as composer install or composer update or whatever.
This SO answer proposes Orion Git API, which unfortunately is not open-source. Another answer on the same SO question noted that korya/node-git-rest-api was incomplete, but it met all my requirements for the server-side:
- can clone private repositories by accepting credentials
- can fetch the contents of a particular file
- can stage a new file, commit it, and push the commit
- can stage modifications to an existing file, commit, and push
- should be dockerifiable (what isnt)
About the class TempFolder, I found that it is replaceable by https://github.com/php-cache/filesystem-adapter
About the class GitDataRepo, it is replaced by the following server-client architecture
- server: https://github.com/shadiakiki1986/docker-node-git-rest-api
- client: https://github.com/shadiakiki1986/git-rest-api-client-php
- flysystem-git adapter: https://github.com/shadiakiki1986/flysystem-git
Check the flysystem-git adapter repo for usage
Installing
composer install
Usage
Check tests/GitDataRepoTest.php
Testing Using SSH keys
- Create a repository on github/bitbucket/etc.
- initialize it
mkdir /path/to/your/project
cd /path/to/your/project
git init
git remote add origin https://shadiakiki1986@bitbucket.org/shadiakiki1986/ffa-bdlreports-maps.git
- make first commit echo "shadiakiki1986" >> contributors.txt git add contributors.txt git commit -m 'Initial commit with contributors' git push -u origin master
2. Generate ssh keys: `ssh-keygen -t rsa -b 4096 -C "shadiakiki1986@gmail.com"`
6. Copy public key to deploy keys setting of repository on github
5. Configure ssh keys
```bash
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
- Run tests
export GITDATAREPO_REMOTE=git@github.com:shadiakiki1986/git-data-repo-testDataRepo composer run-script test
Testing Using github credentials
- Create a repository on github
- Run tests
export GITDATAREPO_REMOTE=https://shadiakiki1986:veggiepizza@github.com/shadiakiki1986/git-data-repo-testDataRepo composer run-script test
Note on bitbucket
For bitbucket repos, one needs
git config --global user.email "you@example.com" git config --global user.name "Your Name" # Omit --global to set the identity only in this repository
Developer notes
travis with ssh keys
- Follow section above on
testing using ssh keys - Encrypt
~/.ssh/id_rsaand~/.ssh/id_rsa.pubusing travis CLI
- Note the need to tar the public and private keys because
travis encrypt-filecannot encrypt more than one file
travis login # enter github credentials tar cvf ssh_keys.tar -C ~/.ssh id_rsa id_rsa.pub travis encrypt-file ssh_keys.tar --add git add ssh_keys.tar.enc
References
- https://docs.travis-ci.com/user/encrypting-files/
- https://grosser.it/2014/03/01/allowing-travis-to-git-clone-by-adding-a-public-ssh-key/
- https://gist.github.com/lukewpatterson/4242707
- https://docs.travis-ci.com/user/private-dependencies/
phpmd
phpmd issued warnings about static access to classes.
I disabled these warnings for the functions in subject.
To see them, check grep SuppressWarnings * -r --exclude-dir=vendor
phpcs
If phpcs reports errors that can be fixed automatically, run vendor/bin/phpcbf src/ and then commit the changes
badges
Badges from badge poser
shadiakiki1986/git-data-repo 适用场景与选型建议
shadiakiki1986/git-data-repo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 267 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 06 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「data」 「git」 「repository」 「data repository」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 shadiakiki1986/git-data-repo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shadiakiki1986/git-data-repo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 shadiakiki1986/git-data-repo 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
repository php library
Easily manage git hooks in your composer config
Adds the EDTF data type to Wikibase
A simple library that allows transform any kind of data to native php data or whatever
MediaWiki extension that allows embedding external content, specified by URL, into your wiki pages
统计信息
- 总下载量: 267
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2016-06-30