scholarslab / bagit
此包已被弃用且不再维护。没有建议的替代包。
无法获取此包最新版本(0.3.1)的许可信息。
0.3.1
2019-11-25 19:39 UTC
Requires
- ext-hash: *
- ext-iconv: *
- ext-zip: *
- pear/archive_tar: ~1.3
Requires (Dev)
- mayflower/php-codebrowser: ~1.1
- pdepend/pdepend: 2.1.0
- phpdocumentor/phpdocumentor: 2.*
- phpmd/phpmd: @stable
- phpunit/phpunit: ~4.4
- sebastian/phpcpd: *
- squizlabs/php_codesniffer: 2.*
This package is not auto-updated.
Last update: 2020-08-21 19:59:02 UTC
README
我们很抱歉通知您,此库不再维护。如果您希望继续使用此库,这里有一些 说明。另外,还有 BagItTools。
BagIt PHP
这是 BagIt 0.96 规范的 PHP 实现
支持的功能
- 包编译
- 清单和标签清单生成
- 标签文件、bag-info.txt 和 bagit.txt 的生成
- 远程文件抓取(fetch.txt)
- 包验证
使用 Composer
BagItPHP 可以通过包仓库使用 composer 安装。您的 composer.json
需要类似以下格式
{ "require": { "scholarslab/bagit": "~0.2" } }
安装
% git clone git://github.com/scholarslab/BagItPHP.git
依赖
您需要安装以下依赖项才能使用此包
- Archive_Tar (http://pear.php.net/package/Archive\_Tar)
示例:创建一个包
require_once 'lib/bagit.php'; define('BASE_DIR', 'testbag'); // create a new bag at BASE_DIR $bag = new BagIt(BASE_DIR); // add a file; these are relative to the data directory $bag->addFile('../phpunit.xml', 'phpunit.xml'); // update the hashes $bag->update(); // create a tarball $bag->package('testbag'); // the bag package will be created at ./testbag.tgz
示例:创建一个扩展包,包含 fetch.txt 和 bag-info.txt 条目
require_once 'lib/bagit.php'; define('BASE_DIR', 'testbag'); // define some metadata to add to bag-info.txt $baginfo = array('First-Tag' => 'This is the first tag value', 'Second-Tag' => 'This is the second tag value' ); // create a new bag at BASE_DIR $bag = new BagIt(BASE_DIR, true, true, true, $baginfo); // add a file; these are relative to the data directory $bag->addFile('../phpunit.xml', 'phpunit.xml'); // add additional metadata to bag-info.txt $bag->setBagInfoData('Third-Tag', 'This is the third tag value'); // add some entries to fetch.txt $bag->fetch->add('http://example.com/bar.htm', 'bar.htm'); $bag->fetch->add('http://example.com/baz.htm', 'baz.htm'); // update the hashes $bag->update(); // create a tarball $bag->package('testbag'); // the bag package will be created at ./testbag.tgz
示例:验证现有包
require_once 'lib/bagit.php'; // use an existing bag $bag = new BagIt('test/TestBag.tgz'); // check validity var_dump((bool)$bag->isValid());
示例:读取包
require_once 'lib/bagit.php'; // use an existing bag $bag = new BagIt('test/TestBag.tgz'); // validate the bag $bag->validate(); // only execute if a valid bag if (count($bag->getBagErrors()) == 0) { // retrieve remote files $bag->fetch->download(); // copy files foreach ($bag->getBagContents() as $filename) { copy($filename, 'final/destination/' . basename($filename)); } }
反馈
我们依靠上述链接的 GitHub 问题跟踪器 来获取反馈。在此处 提交 错误或其他问题。
测试
BagItPHP 库包含单元测试,以确保软件质量。为项目做出贡献的最简单方法之一是告诉我们任何错误,并包含一个测试用例。阅读 build.xml 文件获取有关运行测试、底层报告类型和打包信息更多信息。
关于补丁/拉取请求的说明
- 分支项目
- 实现您的功能添加/错误修复。
- 为它添加测试。这很重要,这样我们就不会在未来的版本中无意中破坏它
- 提交
- 向我们发送一个拉取请求...主题分支将获得额外积分。
加分
感谢所有为此做出贡献的人