shadiakiki1986/flysystem-git
Composer 安装命令:
composer require shadiakiki1986/flysystem-git
包简介
Flysystem adapter for git repositories
README 文档
README
Adapter for flysystem that interfaces to any git repository served with a node-git-rest-api server via git-rest-api-client-php
Usage
Install from packagist
composer install shadiakiki1986/flysystem-git
Launch a node-git-rest-api server
docker run -p 8081:8081 -it shadiakiki1986/docker-node-git-rest-api
Example
<?php require_once 'vendor/autoload.php'; use League\Flysystem\Filesystem; // prepare adapter // http://github.com/shadiakiki1986/git-rest-api-client-php $git = new \GitRestApi\Client('http://localhost:8081'); // for read-write, include the correct username/password below $remote = 'https://someone:somepass@github.com/shadiakiki1986/git-data-repo-testDataRepo'; $repo = $git->cloneRemote($remote,1); // passing 1 for clone --depth to save some time for repositories with a long history // for writing to the remote repo, i.e. if "push" variable below is true, need to set username and email // not needed if read-only usage $repo->putConfig('user.name','phpunit test flysystem-git'); $repo->putConfig('user.email','shadiakiki1986@gmail.com'); // initialize filesystem for further usage $push = false; // set to false to make read/write possible without pushing to remote. Set to true to push to remote $pull = true; // set to true to skip pulling from the remote repository at each transaction in order to save on time $adapter = new \shadiakiki1986\Flysystem\Git($repo,$push,$pull); $filesystem = new Filesystem($adapter); // read a file $contents = $filesystem->read('bla'); // if username/password above are correct, can also update the file $filesystem->update('bla','some new content'); // write to a new file $filesystem->write('new folder/new file','content of file');
统计信息
- 总下载量: 769
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2016-11-22